Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to a SQL server on another computer

Status
Not open for further replies.

steve1rm

Programmer
Aug 26, 2006
255
0
0
GB
Hello,

I have a windows application that uses a SQL Server 2005.

The customer wants to run my application from a computer, and connect to the SQL Server that is on another computer.

Currently the SQL server and application both run on the same computer. The connection string I have is as follows:

connectionString="Data Source=(local);Initial Catalog=ServiceMaster;Integrated Security=True"

If I want to connect to another computer would have to change the data source to the IP address of the computer that has the sql server? How about security issues.

example:
connectionString="Data Source= 10.0.0.163;Initial Catalog=ServiceMaster;Integrated Security=True"

Would the above connection string work?

Thanks in advance,

Steve
 
The customer wants to run my application from a computer, and connect to the SQL Server that is on another computer

Is this another computer located in the same LAN? or you want to connect through the internet?

Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
Hello Walid,

Yes the computers are all on the same LAN.

Just out of interest if you have time, how would you connect if the computers were connected through the internet.

Thanks for you help,

Steve
 
In that case you don’t need to worry about security; you still can use the integrated security and windows authentication. Just provide the server name \\ServerName instead of (local) in the connection string and you will be fine. Most likely that the configuration of the LAN allows SQL-Server to request validation from the domain controller so your user will be validated with the credentials that he provided to log in to the network. However it is possible that his account doesn’t have any access rights to the SQL-Server machine, in that case, give him access to it.

Computers can connect to SQL-Server directly over the internet using TCP/IP, just provide the IP of the machine in which SQL-SERVER is installed. SQL-Server by default doesn’t allow this connection so you will need to configure it to accept it. Lots of security issues involved in this method and you must be careful and fully aware of what you doing. This article and the “see also” links in it may be helpful


Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
Hello Walid,

Thanks for all your help.

but what concerns me is that how do I give him access rights to the sql-server machine.

Thanks for all your help,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top