Solved

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

Posted on 2008-06-16
3
551 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now