Solved

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

Posted on 2008-06-16
3
553 Views
Last Modified: 2008-06-24
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.
0
Comment
Question by:Shiseiryu1
  • 2
3 Comments
 
LVL 10

Expert Comment

by:Dxpert
ID: 21796278
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.
0
 

Author Comment

by:Shiseiryu1
ID: 21797028
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.
0
 
LVL 10

Accepted Solution

by:
Dxpert earned 500 total points
ID: 21797166
I can't really test it here, but maybe you should try to create a login account for sql, and use that instead of the integrated security. Try the approach this guys has here: http://www.sitepoint.com/forums/showthread.php?t=358567

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question