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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing Oracle DB error in ASP

Status
Not open for further replies.

spook007

Programmer
May 22, 2002
259
US
In case my Oracle DB goes down. I would like to redirect my page to a static version of the same page. In order to do this I'm trying to capture the oracle error I get when the Database server is offline.

Currently when I try to access my page I get the following error when the Database server is offline:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Oracle][ODBC][Ora]ORA-12535: TNS:eek:peration timed out

/system/DBAccess.asp, line 22

Line 22 on DBAcess.asp contains my connection string to my database. How can I capture this error and redirect my page if the above error is what caused the page to error out? I appreciate any suggestions!
 
Hi Spook try this.

before you connect

on error resume next
line 22
if err.number <> 0 then 'there is an error
redirect code
end if


 
I've added the code you mentioned above. I placed it after my variable declaration. When I run the script the Err.Number remains 0, nevertheless... I still get the error message!

The nature of the error is a database connection time out. When a connection to the database is not possible (network down), I wanted to capture the error and customize the error screen.

If ASP is indicating Err.Number=0 does it simply not catch these errors, if so why is it still displaying the following message:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Oracle][ODBC][Ora]ORA-12535: TNS:eek:peration timed out

/system/DBAccess.asp, line 22
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top