[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Remote SQL Server Connection via VB 6

I am trying to open a connection to a database on my server from within a vb6 program using the same connection string that I use to access the data online via classic asp web page.  I am getting the following message: "Named pipes provider:  could not open a connection to sql server."
0
Bob Schneider
Asked:
Bob Schneider
  • 5
  • 3
  • 3
  • +1
8 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
What driver and connection string are you trying to use?  I would think that VB6 should probably use a DSN thru the ODBC connection manager.
0
 
Bob SchneiderAuthor Commented:
Here is my connection string (again, worked fine on the old server and works fine now via a classic asp page): srvr_conn.Open "Provider=SQLNCLI11;Server=72.52.136.29;Database=db_name;Uid=uesr_name;Pwd=password;"
0
 
SethiCommented:
You have to mention the name of your computer along with Server IP. Like this: YourComputerName\72.52.136.29.

Also through SQL Server Configuration Manager make sure Named Pipe is enabled.
0
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.

 
SethiCommented:
If the connection is being made on network then it would be: \\YourComputerName\72.52.136.29
0
 
Bob SchneiderAuthor Commented:
Why don't I have to mention the name of my computer when doing the same thing from the web via classic asp?  Also, by "YourComputerName" do you mean the one that i am sending the request from or the server that is receiving the request.  I thought the IP address clearly identified the server and why would I preface that with the name of the computer sending the request?  I guess I am puzzled.

Further, the old server (a Windows Server 2008 with sql server 2012 express) did not need that.  Please fill me in on what I am missing.  I will look at the named pipes setting.
0
 
Bob SchneiderAuthor Commented:
Named Pipes are enaled everywhere I looked.
0
 
SethiCommented:
Well, I won't be able to answer a lot of "Why" about Computer name but having computer name with SQL server name is the correct syntax for Windows application. My guess for ASP is that it goes through IIS Server and uses TCP/IP protocol and that's why we don't need to pass the computer name.

So using your server with computer name is all that needs to be done.
0
 
Dave BaldwinFixer of ProblemsCommented:
In my experience, using the IP address means that the SQL Native Client and the SQL Server must both have TCP/IP connections enabled.  And if you are not on the same machine as the server, then the server must also have 'Remote Connections' enabled.
0
 
Dave BaldwinFixer of ProblemsCommented:
You might try setting up a DSN thru the ODBC manager on the machine where the VB6 program is running to see if your credentials are being accepted.  Note that if the ASP page is running on the same machine that the SQL server is on, it is not a 'Remote Connection'.
0
 
Anthony PerkinsCommented:
I am not sure I am following you entirely, but perhaps the SQL Server Native Client is not installed on this workstation?
0
 
Bob SchneiderAuthor Commented:
I upgraded from sql server 2008 r2 express.  I have sql server 2012 express on my local machine along with sql server 2008 r2 express.  I have a configuration manager under the 2008 sql server but I don't see it in program files under the 2012.

Note that this worked well on my old server (same workstation and a server running windows server 2008 and sql server 2012 express).  It is not working on the new server (running windows server 2012 and sql server 2012).

Hopefully this will help you help me narrow it down.

Thank you very much!
0
 
Anthony PerkinsCommented:
It is not working on the new server (running windows server 2012 and sql server 2012).
So this server is running the Express Edition?  If so I suspect it is a named instance and you may have to connect as 72.52.136.29\SQLExpress.  Have you tried that?

You can confirm whether you can see it by running this from the command line:
SQLCmd /L

It should list all the SQL Server instances that are available.  If there are named instances then assuming that the SQL Browser service is running, they should be displayed as computername\instancename
0
 
Bob SchneiderAuthor Commented:
There was only one instance but it turned out to be express.  Nonetheless, the firewall was blocking the connection.  All is resolved now.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now