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 );
        }
</cfscript>



On Wed, 26 Jan 2005 12:31:27 -0500, Dave Watts <[EMAIL PROTECTED]> wrote:
> > 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>
> 
>        <cfset DatasourceIsReachable = "true">
> 
>        <cfcatch type="database">
>        ... look to see what kind of error you have; if it's because the
> datasource isn't reachable set variable to false ...
>        </cfcatch>
> 
> </cftry>
> 
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> 
> Fig Leaf Software provides the highest caliber vendor-authorized
> instruction at our training centers in Washington DC, Atlanta,
> Chicago, Baltimore, Northern Virginia, or on-site at your location.
> Visit http://training.figleaf.com/ for more information!
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191855
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to