Detect Connection to DB

D

Dooza

Hi there,
I have an intranet on our corporate network. The home page has a
recordset that displays manufacturers in a drop down list. The recordset
gets it data from a database on our co-located webserver.

Very occasionally our internet connection will drop, and during this
time our intranet home page becomes inaccessible due to not being able
to connect to the database server.

What is the best way to deal with this scenario? I would like the page
to carry on being functional, but without the data from the database.
Ideally I would display a message saying the database server is unavailable.

Any ideas?

Cheers,

Steve
 
B

Bob Barrows

Dooza said:
Hi there,
I have an intranet on our corporate network. The home page has a
recordset that displays manufacturers in a drop down list. The
recordset gets it data from a database on our co-located webserver.

Very occasionally our internet connection will drop, and during this
time our intranet home page becomes inaccessible due to not being able
to connect to the database server.

What is the best way to deal with this scenario? I would like the page
to carry on being functional, but without the data from the database.
Ideally I would display a message saying the database server is
unavailable.
Without seeing your code, all I can offer is this air code to illustrate
error-handling:

set cn=createobject("adodb.connection")
on error resume next 'turn on error handling
cn.open connectionstring
if err <> 0 then
response.write "could not connect to database"
response.end
end if
on error goto 0 'turn off error handling

It is best practice to leave error-handling off except for those statements
that "need" it so as not to mask any other errors that occur in your code.
 
D

Dooza

Bob said:
Without seeing your code, all I can offer is this air code to illustrate
error-handling:

set cn=createobject("adodb.connection")
on error resume next 'turn on error handling
cn.open connectionstring
if err <> 0 then
response.write "could not connect to database"
response.end
end if
on error goto 0 'turn off error handling

It is best practice to leave error-handling off except for those statements
that "need" it so as not to mask any other errors that occur in your code.

Hi Bob,
Thank you, this will do the job nicely.

Cheers,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top