Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Error when trying to use asp to connect to Oracle.

Status
Not open for further replies.

ttheobal

Programmer
Nov 6, 2003
13
CA
Hi.

First off the title is a little misleading. I do get an ODBC error, but only if the Disk Cache is emptied or the system hasn't executed the script recently. this is a weird one. Hopefully a super-geek can help.

Ok.. on with it..

I've got an Asp script that connects to Oracle using ODBC and then issues an alter user command to change passwords.

There's 2 docs. The Form.html and the ChgPassword.asp The form sends the info to the asp and the asp does the work.

When I clear my cache, and submit the form for the first time I get. the following error.
(Based on the objects objConn.errors(counter).number and objConn.errors(counter).description)


Error #0
Error desc. -> [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed


Here's the script.

If Error = 0 Then
On Error Resume Next
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "dsn=PRD16A;uid=" & Userid & ";pwd=" & Password & ";"
If objConn.errors.count > 0 then
Response.write(&quot;<h2>Database Errors Occured</h2>&quot; & &quot;<P>&quot;)
For counter= 0 to objConn.errors.count
Response.write(&quot;<B>Error #&quot; & objConn.errors(counter).number & &quot;<BR>&quot;)
Response.write(&quot;Error desc. -> &quot; & objConn.errors(counter).description & &quot;<P></B>&quot;)
counter = counter +1
Next
Else
'do the password change.


I am running on IIS5 on W2K Server. Client is IE 5.50.4807
You will notice there is no error number. Here's the quirky thing. When I refresh the document, the script runs fine. I've tried Oracle ODBC drivers, but I still get the same error. Any ideas?

I will cross post this in the Database and asp scripting forums.

Ideas?

 
Seems like you have a syntex error. The correct syntax looks like:
objConn.Open &quot;dsn=OracleDSN;uid=userid;pwd=password;&quot;

Also you need to make sure to use system DSNs as IIS is a service and it could not use the user dsns.

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top