Solved

Is there any way to enforce default protocol connecting to remote SQL Server using ADO

Posted on 2001-06-13
4
166 Views
Last Modified: 2013-11-23
Is there any way to enforce default protocol (TCP/IP) in the ADO's connection string while connecting to remote SQL Server?

I install my VB app on a WinNT 4.0 SP6 machine from a package created by the Setup Wizard shipped with Visual Basic 6.0 (Service Pack 5 is applied). There is a problem to connect to the remote SQL Server 7 database, though I can ping the remote server both by name and IP address. Application generates an error that it cannot connect to the remote server. After installing SQL Server connectivity tools and changing default protocol to TCP/IP, it works. Is there any way to ensure this connectivity via TCP/IP in the code without the installation of the tools? My application does not use DSN's, a sample of connection string is

strConnect = "Provider=sqloledb;" & _
"Data Source=" & s_ServerName & ";" & _
"Initial Catalog=" & s_DatabaseName & ";" & _
"User Id=" & s_ID & ";Password=" & s_Password & ";"

Thanks!
0
Comment
Question by:tbbrhun
4 Comments
 

Expert Comment

by:deepkumarjl
ID: 6188359
Hi,

I had faced this problem some time back. The only way I found out of this situation was to manually remove NETBEUI and other protocols from the system. Not a good solution, but it works.

Deep
0
 
LVL 2

Expert Comment

by:kiprimshot
ID: 6188360
set the Network Address Property = ip address of server and set the Network Library = DBMSSOCN

I use the dataenvironment and set it up in the connection properties but I think you can use the connection string as well to do this.

hope this helps
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 6188535
here is what the connection string would look like:

Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=<init catalog>;
Data Source=<server name>;Network Address=<your ip>;Network Library=DBMSSOCN
0
 

Author Comment

by:tbbrhun
ID: 6188671
bobbit31:

Thanks a lot, works even without specifying IP Address!

Thanks everyone for help!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question