[Skratchdot.]

Posts Tagged ‘adminapi’:

Recently I was asked how to programmatically verify ColdFusion DataSources. I came up with a few methods of doing so. Each have their pros and cons.

 

Method #1 : Try/Catch using cfquery

 
PROS:
  • Can test for “datasource” specific behavior by using a custom cfquery. If you do this, the query may not work for other datasources, thereby not actually testing the validity of the datasource.
 
CONS:
  • Uses try/catch.
  • Does not work with all datasources. I don’t know of a cfquery that will work for all datasources / DBs / etc
 
NOTES:
This is my least favorite, because I couldn’t come up with a cfquery to test *all* datasources. It will work for some datasources, but not all.
 
SOURCE:
Tagged with: