Link to home
Create AccountLog in
Avatar of Shiseiryu1
Shiseiryu1Flag for United States of America

asked on

Can't Connection to SQL Server 2005 Express via Classic ASP

I setup a SQL Server 2005 database on my local machine and I'm trying to access it via classic ASP.  I setup a DSN and tested the connection and it works.  However, whenever I try to use it, I get a "login failed" message.  Also, if I try to connect without DSN I get a similar message.  Below are the exact strings I've tried an the corresponding messages.  Please help!

'Connection String via DSN
Conn.Open "DSN=MHH"

'Error Message
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "myherbalharmony" requested by the login. The login failed.

'Connection String non-DSN
Conn.Open "Provider=SQLNCLI;Data Source=USERE3A8\SQLEXPRESS;Initial Catalog=myherbalharmony; Integrated Security=SSPI"

'Error Message
Microsoft SQL Native Client (0x80004005)
Cannot open database "myherbalharmony" requested by the login. The login failed.
Avatar of Dxpert
Dxpert
Flag of United States of America image

I think the problem here, has to do with the permissions. How's the permissions set on sql?
What I'm trying to say here is that, when you (the logged in user) runs the DSN test connection it work, because you have access to the DB. But when you try it through ASP it will fail because it runs under the IUSR_machine identity.
Avatar of Shiseiryu1

ASKER

I totally agree.  My iuser account is IUSR_usere3a8; however, I can't find where to adjust the permissions for it in SQL.  If I open up the SQL Server Management Studio Express > right click the database > select "Properties" > select "Permissions" > Select "Add" > and type "IUSR_usere3a8" it doesn't find the name.  

What am I missing here?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Dxpert
Dxpert
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer