|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
Did you build you connection string on the web server computer?
|
|
#5
|
|||
|
|||
|
yes, Its a colocated server which I have remote access for.
|
|
#6
|
|||
|
|||
|
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.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > please help with asp database connection 'login fails' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|