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

checking if database is available

Status
Not open for further replies.

doyle9732

Programmer
Apr 12, 2002
185
CA
we have a database that is used for almost everything in our web interfaces. We also have one admin who periodically updates the information and for whatever reason, when this admin has the database open it shuts everyone out - and we can't find a fix (I've posted here about it and tried everything and nothing has changed the situation)....so, I'd like to at least have a nice error message stating that the database is being maintained, please try back later - instead of the ugly CF error that is thrown. Trouble is, I have no idea what I'm testing for! <cfif database is available> great<cfelse> DB being maintain, try later</cfif>

Anyone know the proper code to use?

thanks!
Stephanie

p.s. the CF error states that the DB is opened exclusively by IP user.....
 
you could use cftry /cfcatch

<cftry>
<!--- simple query to test db if your tables are huge i'd make just a small table with one field and one value so it returns quickly --->
<cfquery name = "qTest" datasource = "dsn">
SELECT something
FROM table
</cfquery>
<cfcatch>
I'm sorry the database is currently down. Please try again
</cfcatch>
</cftry>

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Sounds like your using access to me.

Try usign the cftry/catch. that way if there is and error you can control it.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top