ssaville24
asked on
ASP-DB Connection
I'm getting this error
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
''' app database
dim cn
set cn = Server.CreateObject("ADODB
appDB = "PROVIDER=SQLOLEDB;SERVER=
cn.Open appDB <--this line errors
ASKER
Yes unfortunately, same error.
OK. What version of SQL Server?
ASKER
SQL Server 2000
Windows 2003
IIS6
it works fine with SQL Server 7, Windows 2000, and IIS5
Windows 2003
IIS6
it works fine with SQL Server 7, Windows 2000, and IIS5
Sure the username and password is still valid for the SQL Server 2000 box? Can you ping the SQL Server's IP address from the web server? Is the SQL Server running (sorry, you have to ask these questions sometimes, please don't take offence)?
Have you upgraded your MDAC as of late? It typically comes with SQL Server service packs, but sometimes, the update doesn't happen. Go to:
http://www.microsoft.com/downloads/results.aspx?productID=&freetext=mdac&DisplayLang=en
and download MDAC 2.8.
I've found that doing this solves a lot of connection problems. Earlier versions of the MDAC don't recognize OLE DB connection strings.
GoofyDawg
http://www.microsoft.com/downloads/results.aspx?productID=&freetext=mdac&DisplayLang=en
and download MDAC 2.8.
I've found that doing this solves a lot of connection problems. Earlier versions of the MDAC don't recognize OLE DB connection strings.
GoofyDawg
ASKER
Thanks GoofyDawg, but I installed the MDAC 2.8 and same error.
Yes the SQL is running, because it works for different sites and databases.
And muzzy2003 no offense taken.
Yes the SQL is running, because it works for different sites and databases.
And muzzy2003 no offense taken.
Good. :)
Does it work for different sites on the same web server connecting to different databases on the same SQL server? Are you sure the login you are using actually has permissions on the database you are trying to access?
Does it work for different sites on the same web server connecting to different databases on the same SQL server? Are you sure the login you are using actually has permissions on the database you are trying to access?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes on different webpages, it works to connect to a seperate database on the same SQL Server. Under SQL Enterprise Manager both users are listed in the Users in the seperate databases.
Well, this is getting me stumped. Can you copy and paste a working connection string from another page and yours into a reply to this? Just XXX out the password and, if you really feel you need to, the first octet of the IP address.
Have you tried using the older connection string method... pre-OLEDB? I've found that sometimes that works:
Provider=MSDASQL; Driver={SQL Server}; Server=server_name_or_addr ess; Database=database_name; UID=username; PWD=password;
This is a DSN-less connection. Also, have you looked at the rights you've assigned to your user accounts?
GoofyDawg
Provider=MSDASQL; Driver={SQL Server}; Server=server_name_or_addr
This is a DSN-less connection. Also, have you looked at the rights you've assigned to your user accounts?
GoofyDawg
ASKER
Const CONNECTION_PROVIDER = "SQLOLEDB"
Const CONNECTION_SERVER = "xxx.xxx.xxx.xxx"
Const CONNECTION_UID = "username"
Const CONNECTION_PW = "password"
Const CONNECTION_DATABASE = "dbname"
Const ADO_CONNECTION_CLASS = "ADODB.Connection"
Function GetOpenConnection()
Dim objConn
Set objConn = Server.CreateObject(ADO_CO NNECTION_C LASS)
objConn.ConnectionString = "PROVIDER=" & CONNECTION_PROVIDER &_
";SERVER=" & CONNECTION_SERVER &_
";UID=" & CONNECTION_UID &_
";PWD=" & CONNECTION_PW &_
";DATABASE=" & CONNECTION_DATABASE
objConn.open
Set GetOpenConnection = objConn
End Function
And GoofyDawg the rights are set up as public, db_owner.
Const CONNECTION_SERVER = "xxx.xxx.xxx.xxx"
Const CONNECTION_UID = "username"
Const CONNECTION_PW = "password"
Const CONNECTION_DATABASE = "dbname"
Const ADO_CONNECTION_CLASS = "ADODB.Connection"
Function GetOpenConnection()
Dim objConn
Set objConn = Server.CreateObject(ADO_CO
objConn.ConnectionString = "PROVIDER=" & CONNECTION_PROVIDER &_
";SERVER=" & CONNECTION_SERVER &_
";UID=" & CONNECTION_UID &_
";PWD=" & CONNECTION_PW &_
";DATABASE=" & CONNECTION_DATABASE
objConn.open
Set GetOpenConnection = objConn
End Function
And GoofyDawg the rights are set up as public, db_owner.
ASKER
Gary Thanks for your help, I followed those instructions, and it gave me a working connection string !
Here's what worked...
Provider=SQLOLEDB.1
Here's what worked...
Provider=SQLOLEDB.1
Provider=SQLOLEDB;Data Source=serverip;User ID=username;Password=passw
Does it still error?