views:

47

answers:

3

Hi there,

I've got a recordset/paging set up - works fine in IIS6 but when I run the site on an IIS7 server I get the following error:

    Microsoft OLE DB Provider for SQL Server  error '80004005'

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

/orders.asp, line 197

the code looks like this:

  Set objPagingConn = Server.CreateObject("ADODB.Connection")

objPagingConn.Open CONN_STRING

Set objPagingRS = Server.CreateObject("ADODB.Recordset") objPagingRS.PageSize = iPageSize objPagingRS.CacheSize = iPageSize objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText

iPageCount = objPagingRS.PageCount iRecordCount = objPagingRS.RecordCount

Line 197 is the objPagingConn,Open ... line. I've got about 10 sites like this to migrate - is there a simple fix in IIS7???

Help is greatly appreciated! Many thanks, Martin

A: 

Sounds like you lost permissions to your sql server when you changed over. What is your connection string? Are you trying to use a trusted connection? If so, perhaps IIS7 is running under a different account.

Russell Steen
My current connection string is (like):Provider=SQLOLEDB;Server=xxx.xxx.xxx.xxx;Initial Catalog=mydb;User ID=myuser;Password=password;
Spudhead
A: 

Take a look at this MSDN article:

You may receive this error message when the following conditions are true:

  • SQL Server 2005 or SQL Server 2000 is installed on a cluster.
  • You are connecting to a SQL Server named instance by using TCP/IP sockets.
  • IPSec policy is enabled on the client domain.
  • IPSec policy is not enabled on the server domain.

They reccomend updating your connection string with the port # or named pipe name:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=clientID;Data Source=tcp:TcpIpAddress,port

Chris Pebble
Cheers - have you got a real world example for a server/password? Or should I look on connectionstrings.com?
Spudhead
A: 

After many, many experiments I found a connection string that worked:

Provider=SQLOLEDB.1;Server=123.123.123.123,1433;Initial Catalog=mydb;Persist Security Info=True;User ID=sqladmin;Password=password;

I hope this helps someone else who comes across the same problem - it's been bugging me for so long!

Spudhead