Test/Verify Datasource Connection
I am trying to figure out how to test that a connection to a datasource is available with out querying the database server...
For example, I currently do the following:
------------------------------------------------------------------
<!--- attempt to connect to datasource --->
<cftry>
<cfquery datasource="#this.getName()#" name="test">
SHOW TABLES;
</cfquery>
<cfcatch type="database">
<cfif displayError>
<cfthrow message="Datasource Connection Failed" />
<cfelse>
<cfreturn false />
</cfif>
</cfcatch>
</cftry>
------------------------------------------------------------------
I would like to be able to do this without running a query... is there any way to just ask coldfusion if it can communicate with the datasource? I want to be able to do something similar to:
<cfif datasource.isAvailable() >
<!--- DO SOME DATABASE WORK --->
</cfif>
But I do not want to add an extra db query everywhere.... All opinions, suggestions, ideas are welcome... Thanks!!
