Copy link to clipboard
Copied
Hi All,
How can i check whether the Data Base is Up or Down in cold fusion.Bacause in Cold fusion Data base connectional are made in Connection pool as in Data source in Admin part, But some time my Data base goes down.In that time the Data source is correct .And the my .cfm file try to access the DB but DB is not responsing. So bacause of this my Application goes slow .Please help me how can i check the DB is up or down in Cold fusion coding.
Thanks & My Best regrads
Karthikeyan.J
Copy link to clipboard
Copied
As far as I know you can't
You can check to see if the database is responding by trying a query
<cftry>
<cfquery name="something" datasource="mydsn">
select something trivial from something else trivial
</cfquery>
<cfcatch type="database">DB is not responding</cfcatch>
</cftry>
otherwise to see if the DB is "up" or "down" you need server access, cause it could always be up but not ersponding...
-sean
Copy link to clipboard
Copied
Sure... here's a good way to do it.
What's nice about this strategy is that, not only is it very rugged and reliable, but it is also very efficient. "99.9% of the time, a timeout does not happen," but when and if it does, you can very-reliably handle it ... as the "exception to the rule" that it properly is. You should apply this strategy in all of your code.