Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

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 …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

11 Experts available now in Live!

Get 1:1 Help Now