You need to create an alias in the registry...
HKLM\Software\Microsoft\MSSQLServer\Client\ConnectTo
Try this on your machine using the client configuration program to create an
alias and you can see the entries you need to create.
i.e. name of 'fred' wilth value of 'DBMSSOCN,1.0.0.1'
tells sqlserver to use TCPIP if a server name of fred is specified and to
look at ip address 1.0.0.1
Hope this helps....
Mark Everest
Everest Consultancy Ltd
7, Byron Close, Ludgershall, Andover,
Hampshire SP11 9QX, United Kingdom.
Tel: 01264 395636 Mobile: 0973 787386 Fax: 07092 208191
Email: mailto:mark@e...
The information contained in this email message may be privileged,
confidential, nonsensical or exempt from disclosure under applicable law,
or just common decency (whatever that may mean). If you are not the intended
recipient, then this will be of no interest to you at all and you are hereby
notified that any use, dissemination, distribution or copying of this
communication is strictly prohibited and very, very sad. If you have
received this communication in error, or if any problems occur with
transmission, please blame the technology involved. (I can't believe that
you have just read all of this!!!)
-----Original Message-----
From: Russell Peto [mailto:russell@i...]
Sent: 11 December 2000 10:23
To: professional vb
Subject: [pro_vb] Setting connection protocol for a system DSN
programmatically
Hi all,
I have a piece of code to programmatically set up a system DSN in a manner
that is invisible to the user in order to connect to a remote SQL Server
7.0 database without any user input or prompting. It achieves this by
writing directly to the registry using the RegCreateKey command.
The problem is that it defaults to a named pipes protocol which doesn't
work reliably over an internet connection.
Is there any way of setting up the DSN so that it defaults to a TCP/IP
protocol?
Any help would be greatly appreciated.
The code is below (as usual, apologies for the length of the message)....
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" & _
DataSourceName, hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, "Database", 0&, REG_SZ, _
ByVal DatabaseName, Len(DatabaseName))
lResult = RegSetValueEx(hKeyHandle, "Description", 0&, REG_SZ, _
ByVal Description, Len(Description))
lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
ByVal DriverPath, Len(DriverPath))
lResult = RegSetValueEx(hKeyHandle, "LastUser", 0&, REG_SZ, _
ByVal LastUser, Len(LastUser))
lResult = RegSetValueEx(hKeyHandle, "Server", 0&, REG_SZ, _
ByVal Server, Len(Server))
lResult = RegCloseKey(hKeyHandle)
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
"SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, _
ByVal DriverName, Len(DriverName))
lResult = RegCloseKey(hKeyHandle)
Russell Peto