Link to home
Start Free TrialLog in
Avatar of Schurink
Schurink

asked on

SQL DB connection error...

Hi All,

I have a webserver (W2k) and a separate SQL (2000 ) server.
I configured ODBC on the webserver and the test was successfull:

Microsoft SQL Server ODBC Driver Version 03.80.0194
Running connectivity tests...
Attempting connection
Connection established
Verifying option settings
Disconnecting from server
TESTS COMPLETED SUCCESSFULLY!

I use SQL server authentication and the integrated sql account has public and db_datareader rights.
I created an .asp page to use this ODBC to connect to the database and read all contents of a given table.
Unfortunately when accessing the asp page it returns the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

The contents ( the part which should make the connection) of the page is as follows:
<%
Dim Connect, selectSQL, RecSet
Set Connect = CreateObject ("ADODB.Connection")
Connect.Open "DSN=dsnname"
selectSQL = "SELECT * FROM TABLE"
Set RecSet = Connect.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write RecSet("1") & ", " & RecSet("2") & "<BR><BR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Connect.Close
Set RecSet = Nothing
Set Connect = Nothing
%>

Can you maybe help me on this? It's giving me a hard time....
Cheers!
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve Bink
>>> Connect.Open "DSN=dsnname"

Have you saved the login information in the DSN?  You can also provide it in the connection string:

Connect.Open "DSN=dsnname;UID=username;PASSWORD=password"
Avatar of Schurink
Schurink

ASKER

Hi Tim,
I used your suggestion and it works now.... thank you for replying!

Cheers!