What is the easiest way to check if a data source is available?
I want to test in the Application.cfm file if a data source is reachable and
set a true. Then load the site.
Rick
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database:
cftry
cfquery datasource=dsn name=check
Select * from table
/cfquery
cfcatch
cfabort
!-- or something else ---
/cfcatch
/cftry
emmet
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 26, 2005 11:47 AM
To: CF-Talk
Subject: Check Data Source
What is the easiest way to check if a data source is available?
I want to test in the Application.cfm file if a data source
is reachable and set a true. Then load the site.
You can query the datasource within an exception handler:
cftry
cfquery ...
...
/cfquery
Well that's simple enough...Thanks Dave, Emmet. I was trying to do an HTTP
request into the admin area.
Rick
-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 26, 2005 11:31 AM
To: CF-Talk
Subject: RE: Check Data Source
What is the easiest way
I guess you can use this function however be aware that it uses
undocumented cf service factory.
cfscript
function verifyDatasource( dsn ){
return createObject('java',
'coldfusion.server.ServiceFactory').DataSourceService.verifyDataSource(
arguments.dsn );
}
5 matches
Mail list logo