Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / General ASP Topics / July 2009



Tip: Looking for answers? Try searching our database.

Detect Connection to DB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dooza - 01 Jul 2009 09:44 GMT
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
Bob Barrows - 01 Jul 2009 12:01 GMT
> Hi there,
> I have an intranet on our corporate network. The home page has a
[quoted text clipped - 9 lines]
> 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.

Signature

Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Dooza - 01 Jul 2009 12:29 GMT
>> Hi there,
>> I have an intranet on our corporate network. The home page has a
[quoted text clipped - 23 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.