Solved

Connect vb6 app to remote db

Posted on 2013-01-05
5
483 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 82

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 82

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 82

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now