3
votes

I'm trying to make a connection to a SQL Server Express DB on localhost, but I get the following error message:

Microsoft OLE DB Provider for SQL Server (0x80004005)

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

The code I'm using is

Dim connection 
Set connection = CreateObject("ADODB.connection") 
connection.connectionString = "server=localhost;Provider=SQLOLEDB;Data Source=RiskManagement;Initial Catalog=RiskManagement;User ID=sa;Password=myPass;" 
connection.Open() 

Any ideas?

3

3 Answers

3
votes

First thing to always check is that you have configured SQL Server to allow remote connections.

How to configure SQL Server 2005 to allow remote connections

For generic SQL Server Connectivity Troubleshooting consult the following Blog Post

0
votes

I also faced same issue, when I investigated around the network connectvity then I come to know from application server (example Windows 10.10.10.10 or AppServer) is unable to connect database server (Like DBServer or 10.10.10.11). So once check whether it's pinging from the application server, where application is hosted or located.

0
votes

I got this issue because ESET firewall was on. I installed an update of a VB6 program. The new .exe had to be entered into the firewall