Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 1st, 2004, 07:57 PM
danny__t danny__t is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 15 danny__t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy please help with asp database connection 'login fails'

I've been trying to suss this for hours now with no luck at all. I'm trying to connect to a sql server database on a win2003 webserver running IIS6 (both IIS and sql server on same machine).

I have set up the database and added a user 'CLUSR' with a password, I can log into query analyzer and return the info I want using this username and password.

I am consistantly getting the following error trying to connect with asp: -

Microsoft OLE DB Provider for SQL Server error '80004005'
Cannot open database requested in login 'my_database'. Login fails.
/test.asp, line 7

test is a simple asp file I created to try and get this to work and contains the following code: -

<%
Option Explicit

Dim myConn, rsTest, prodName

Set myConn = server.createobject("adodb.connection")
myConn.open "Provider=SQLOLEDB;Server=(local);User ID=CLUSR;Password=mypass;Database=my_database;"


strSQL = "SELECT products.* FROM products"
Set rsTest = server.createobject("adodb.recordset")
rsTest.open strSQL, myConn

rsTest.movefirst
Do while not rsTest.eof
prodName = rsTest.fields(1)
response.write(prodName & "<br>")
rsTest.movenext
Loop

set rsTest = nothing
rsTest.close

set myConn = nothing
myConn.close

%>

I've been going around in circles with sql server users, permissions, etc as well as getting completely lost in IIS security settings.

If anyone can shed any light on this at all you will gain instant promotion to the top of my christmas card list and save me from near imminent frustration overload!

Cheers

Reply With Quote
  #2  
Old April 1st, 2004, 08:13 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 9 m 23 sec
Reputation Power: 181
I think your connection string is incorrect

You could try using this tip to create a working connection string, since you seem to have access to the server itself.

http://www.dougscode.com/forum4/topic.asp?TOPIC_ID=11
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old April 1st, 2004, 09:04 PM
danny__t danny__t is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 15 danny__t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
quality tip there, will come in very handy for future reference... unfortunately didnt work in this case I managed to create the udl file and test the connection successfully, but then when used in the asp file get the following:




Microsoft OLE DB Provider for SQL Servererror '80040e4d'

Login failed for user 'CLUSR'. /northtest.asp, line 7

as the udl connection worked fine, and I can use query analyzer fine could this be a problem in IIS 6? If so anyone got any ideas as to what?

Cheers

Reply With Quote
  #4  
Old April 2nd, 2004, 12:48 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 9 m 23 sec
Reputation Power: 181
Did you build you connection string on the web server computer?

Reply With Quote
  #5  
Old April 2nd, 2004, 03:29 AM
danny__t danny__t is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 15 danny__t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
yes, Its a colocated server which I have remote access for.

Reply With Quote
  #6  
Old April 2nd, 2004, 11:06 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 9 m 23 sec
Reputation Power: 181
Then if you are using the exact same connection string from the udl file and in your asp code, and testing everything on the server itself, I don't know why it would not work from asp. Maybe there is something in the sql server logs or the system event logs that will help you track this down.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > please help with asp database connection 'login fails'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT