Sally
Sally

Reputation: 1789

Invalid Instance when using ADODB.Recordset

I have migrated from one sever to another. I have restored my database and reset up my website. Since migrating however my website will not connect to the database I am getting the following error:

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.

My connection string is in the form of

CON_STRING = "Provider=SQLOLEDB;Data Source=myserver;Initial Catalog=mydb;User Id=user;Password=password"

The error is being thrown on the second line of the code below

Set rsBCT = Server.CreateObject("ADODB.Recordset")
rsBCT.ActiveConnection = CON_STRING

Would there be anything settings wise on the server that would need changing for this work? How can I try and debug what is going wrong. All my other applications which use web.config files are connecting fine. What troubleshooting steps can I take?

Upvotes: 0

Views: 6633

Answers (2)

Orhun Alp Oral
Orhun Alp Oral

Reputation: 754

You may try to connect SQL instance higher than your OLEDB client version.

Therefore you can try to change your provider to "SQLNCLI" (Native SQL Client)

CON_STRING = "Provider=SQLNCLI;Data Source=myServer;Initial Catalog=mydb;User Id=user;Password=password"

Upvotes: 0

Tomalak
Tomalak

Reputation: 338208

Use the instance name of the server in the connection string:

CON_STRING = "Provider=SQLOLEDB;Data Source=myServer\myInstance;Initial Catalog=mydb;User Id=user;Password=password"
----------------------------------------------------^^^^^^^^^^^

Upvotes: 2

Related Questions