all groups > sql server odbc > october 2003 >
You're in the

sql server odbc

group:

SQL Server ODBC Connection string format for TCP/IP connection


SQL Server ODBC Connection string format for TCP/IP connection Andrew Chalk
10/27/2003 2:40:42 PM
sql server odbc: I am trying to make an ODBC connection to a remote SQL Server 2000 server
over TCP/IP. I get a "dialog failed" error when I call SQLDriverConnect()
with the following syntax:

"DRIVER={SQL
Server};SERVER=192.168.0.2;DATABASE=Fred;Trusted_Connection=Yes"

can anyone tell me the syntax error?

The IP address is actually the address of my local machine and the following
(non-TCP/IP) connestion string deos work.

"DRIVER={SQL Server};SERVER=(local);DATABASE=MCS
Logger;Trusted_Connection=Yes"

Many thanks.

Re: SQL Server ODBC Connection string format for TCP/IP connection Sue Hoegemeier
10/27/2003 7:36:05 PM
Try using the string with local for the server but add the
network library parameter to specify the network library to
use: "Network=DBMSSOCN;" for TCP/IP

-Sue


On Mon, 27 Oct 2003 14:40:42 -0600, "Andrew Chalk"
[quoted text, click to view]
Re: SQL Server ODBC Connection string format for TCP/IP connection Andrew Chalk
10/28/2003 12:30:35 AM
Many thanks, Sue. Turned out that works for my local app. to access the
database. However, when the app. is not on the SQL server machine my (.NET)
application gives a security exception to do with the database acccess. The
app. appears but no data gets accessed. I think it is something to do with
the SQL machine password/database password. Can you see how I should modify
the string to provide this data?

Here is how the connection string looks now:

"DRIVER={SQL
Server};SERVER=(local);NETWORK=dbmssocn;ADDRESS=192.168.0.6,1433;DATABASE=Fr
ed;Trusted_Connection=Yes"

Thanks!



[quoted text, click to view]

Re: SQL Server ODBC Connection string format for TCP/IP connection Sue Hoegemeier
10/28/2003 7:52:28 AM
If you are suppose to be using a login and password to
connect to this other SQL Server, then you need to remove
Trusted_Connection as this is for Windows Authentication.
For SQL Server logins or standard security use
UID=YourUserID and PWD=YourPassword.
Remove the Server=local if you are no longer connecting to a
server on your own PC - server should be the new server.
It's a good idea to learn what the pieces of the connection
string represent so you can make modifications and
adjustments as needed. You can find more information and
sample connection strings for different scenarios at:
http://www.able-consulting.com/ADO_Conn.htm

-Sue

On Tue, 28 Oct 2003 00:30:35 -0600, "Andrew Chalk"
[quoted text, click to view]
AddThis Social Bookmark Button