Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connect vb6 app to remote db

Posted on 2013-01-05
5
Medium Priority
?
534 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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 2000 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

Expert Comment

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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

877 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