Solved

Connect vb6 app to remote db

Posted on 2013-01-05
5
494 Views
Last Modified: 2013-01-05
I am trying to connect my vb6 app to either a local or a remote database, depending on which is selected.  Here is my connection string:

    If sWhichSrvr = "Remote" Then
        conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CCMeet;User ID=id;Password=pwd;Data Source=209.185.199.1,1433\SQLEXPRESS"
    Else
        conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CCMeet;UID=id;Pwd=pwd;Data Source=VIRA-5\SQLEXPRESS"
    End If

Open in new window


I get a "server not found" error when I try to connect.  Is there an error in my string or my process?
0
Comment
Question by:Bob Schneider
  • 3
  • 2
5 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
ID: 38747403
SQLOLEDB is an old driver.  The preferred and current driver for SQL Server 2008 is the SQL Server Native Client 10.0 which can be downloaded here:  http://www.microsoft.com/en-us/download/details.aspx?id=16978   Look for Microsoft® SQL Server® 2008 R2 Native Client in the middle of the page and pick the version for your computer.

On this page are connection strings for using SQLNCLI10: http://www.connectionstrings.com/sql-server-2008

SQL Server must also be setup for TCP/IP remote access using SQL authentication.  If you are trying to access it using 'named instance' like 209.185.199.1,1433\SQLEXPRESS or VIRA-5\SQLEXPRESS, the Sqlbrowser.exe service must also be running on port 1434.
0
 

Author Comment

by:Bob Schneider
ID: 38747493
Good information.  Sqlbrowser.exe (I assume that is SQL Server browser in the "Services" area?) is running but I can't see how to check the port it is running on?  TCP/IP is enabled but how do I check if it is using SQL authentication?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 38747591
Sqlbrowser.exe always runs on port 1434 as far as I know.  Allowing Remote connections is a checkbox on the Properties for the server instance (top of the list).  SQL authentication is set up for a user in the Properties for their Login when it is created.  And under the Properties for the database you're using, you may have to setup permissions for that login.
0
 

Author Closing Comment

by:Bob Schneider
ID: 38747604
Incredibly helpful!!
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38747625
Glad to help.
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now