Solved

Connect vb6 app to remote db

Posted on 2013-01-05
5
510 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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…

756 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