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

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

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.Connection")
appDB = "PROVIDER=SQLOLEDB;SERVER=serverip;UID=username;PWD=password;DATABASE=dbname"
cn.Open appDB <--this line errors
0
ssaville24
Asked:
ssaville24
  • 6
  • 5
  • 2
  • +2
1 Solution
 
muzzy2003Commented:
Try this:

Provider=SQLOLEDB;Data Source=serverip;User ID=username;Password=password;Initial Catalog=dbname;"

Does it still error?
0
 
ssaville24Author Commented:
Yes unfortunately, same error.
0
 
muzzy2003Commented:
OK. What version of SQL Server?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ssaville24Author Commented:
SQL Server 2000
Windows 2003
IIS6

it works fine with SQL Server 7, Windows 2000, and IIS5
0
 
lengreenCommented:
Hi

Take a look at

http://www.connectionstrings.com/

cheers

Len
0
 
muzzy2003Commented:
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)?
0
 
GoofyDawgCommented:
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
0
 
ssaville24Author Commented:
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.
0
 
muzzy2003Commented:
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?
0
 
Yrag1Commented:
Hi look at this question it should help you.

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21192995.html

my instruction on creating a universal data link are near bottom.

Gary
0
 
ssaville24Author Commented:
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.  
0
 
muzzy2003Commented:
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.
0
 
GoofyDawgCommented:
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_address; 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
0
 
ssaville24Author Commented:
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_CONNECTION_CLASS)
      
      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.
0
 
ssaville24Author Commented:
Gary Thanks for your help, I followed those instructions, and it gave me a working connection string !  

Here's what worked...

Provider=SQLOLEDB.1
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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