Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ms sql connection error


Message #1 by mpelley@c... on Tue, 12 Nov 2002 16:06:05
Hi, I'm fairly new to ASP and ms sql, I was able to get this script to run 
fine with access but since I moved up to ms sql I have been having trouble 
to get it to connect to the database, I get the following error.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database 
requested in login 'intra'. Login fails.
/scripts/bbrd/area1/updatedb.asp, line 193


I have created an odbc dsn and tested it and it seams to work fine but 
when I go to acess it through my asp script the error pops up. Here is my 
code:

set contodb=server.createobject("adodb.connection")
contodb.ConnectionTimeout=30
contodb.open "dsn=intranet;uid=IUSR_Intranet;pwd=*******;Database=intra;Tru
sted_Connection=yes"

if anyone can help me out with this I would really appreaciate it.

thanks mark






Message #2 by "Drew, Ron" <RDrew@B...> on Tue, 12 Nov 2002 13:57:08 -0500
This is the connect string I use for my Intranet and it works fine.
Just replace the SERVER=3D and DATABASE=3D and if necessary change the 
sa
userid and password to whatever...make sure you have an ODBC

Set objConn =3D Server.CreateObject("ADODB.Connection")
  
   objConn.Open "DRIVER=3DSQL 
Server;SERVER=3DBDFINTRA;UID=3Dsa;APP=3DMicrosoft
Open Database Connectivity;WSID=3DSNRM_48001F5M;DATABASE=3Dsales;User
Id=3Dsa;PASSWORD=3D;"


-----Original Message-----
From: mpelley@c... [mailto:mpelley@c...]
Sent: Tuesday, November 12, 2002 11:06 AM
To: ASP Databases
Subject: [asp_databases] ms sql connection error


Hi, I'm fairly new to ASP and ms sql, I was able to get this script to
run
fine with access but since I moved up to ms sql I have been having
trouble
to get it to connect to the database, I get the following error.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC
SQL Server Driver][SQL Server]Cannot open database
requested in login 'intra'. Login fails.
/scripts/bbrd/area1/updatedb.asp, line 193


I have created an odbc dsn and tested it and it seams to work fine but
when I go to acess it through my asp script the error pops up. Here is
my
code:

set contodb=3Dserver.createobject("adodb.connection")
contodb.ConnectionTimeout=3D30
contodb.open
"dsn=3Dintranet;uid=3DIUSR_Intranet;pwd=3D*******;Database=3Dintra;Tru
sted_Connection=3Dyes"

if anyone can help me out with this I would really appreaciate it.

thanks mark






Message #3 by "Ken Schaefer" <ken@a...> on Wed, 13 Nov 2002 14:16:23 +1100
Are you using a TrustedConnection? (ie Integrated Authentication?). If so,
then the username/password etc stuff is useless, as ADO will use the current
user context to logon to the SQL Server. Do it like this:

strDBConnString = _
    "Provider=SQLOLEDB;" & _
    "Data Source=myDatabaseServer;" & _
    "Initial Catalog=Intra;" & _
    "Integrated Authentication=SSPI;"

If you are using SQL Server authentication, then configure the DSN with the
correct SQL Server username/password that you want to use. Make sure that
this user is allowed to login to the Intra database.

strDBConnString = "DSN=Intranet"
objConn.Open strDBConnString

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <mpelley@c...>
Subject: [asp_databases] ms sql connection error


: Hi, I'm fairly new to ASP and ms sql, I was able to get this script to run
: fine with access but since I moved up to ms sql I have been having trouble
: to get it to connect to the database, I get the following error.
:
: Error Type:
: Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
: requested in login 'intra'. Login fails.
: /scripts/bbrd/area1/updatedb.asp, line 193
:
:
: I have created an odbc dsn and tested it and it seams to work fine but
: when I go to acess it through my asp script the error pops up. Here is my
: code:
:
: set contodb=server.createobject("adodb.connection")
: contodb.ConnectionTimeout=30
: contodb.open
"dsn=intranet;uid=IUSR_Intranet;pwd=*******;Database=intra;Tru
: sted_Connection=yes"
:
: if anyone can help me out with this I would really appreaciate it.


  Return to Index