Unfortunately not. The following code hangs there
forever when a DS is not available, thanks anyway.
<CFTRY>
<!--- Get "factory" --->
<CFOBJECT ACTION="CREATE"
TYPE="JAVA"
CLASS="coldfusion.server.ServiceFactory"
NAME="factory">
<!--- Get datasource service --->
<CFSET dsService=factory.getDataSourceService()>
<!--- Validate DSN --->
<CFSET
result=dsService.verifyDatasource("someRemoteDS")>
<!--- If any error, return FALSE --->
<CFCATCH TYPE="any">
<CFSET result="false">
</CFCATCH>
</CFTRY>
<CFIF result IS NOT "false">
DS THERE
<cfelse>
remote ds not available.
</cfif>
--- Matthew Walker <[EMAIL PROTECTED]> wrote:
> These two cfmx UDFs from cflib.org may help:
>
>
> <cfscript>
> function DSNExists(DSN) {
> var factory =
>
createObject("java","coldfusion.server.ServiceFactory");
> var DSNs =
> factory.getDataSourceService().getNames();
> return
> yesNoFormat(listFindNoCase(arrayToList(DSNs),
> DSN));
> }
> </cfscript>
>
>
> <!---
> Verifies a DSN is working.
>
> @param dsn Name of a DSN you want to verify.
> (Required)
> @return Returns a Boolean.
> @author Ben Forta ([EMAIL PROTECTED])
> @version 1, October 15, 2002
> --->
> <CFFUNCTION NAME="VerifyDSN" RETURNTYPE="boolean">
> <CFARGUMENT NAME="dsn" TYPE="string"
> REQUIRED="yes">
>
> <!--- initialize variables --->
> <CFSET var dsService="">
> <!--- Try/catch block, throws errors if bad DSN
> --->
> <CFSET var result="true">
>
>
> <CFTRY>
> <!--- Get "factory" --->
> <CFOBJECT ACTION="CREATE"
> TYPE="JAVA"
>
> CLASS="coldfusion.server.ServiceFactory"
> NAME="factory">
> <!--- Get datasource service --->
> <CFSET
> dsService=factory.getDataSourceService()>
> <!--- Validate DSN --->
> <CFSET result=dsService.verifyDatasource(dsn)>
>
> <!--- If any error, return FALSE --->
> <CFCATCH TYPE="any">
> <CFSET result="false">
> </CFCATCH>
> </CFTRY>
>
> <CFRETURN result>
> </CFFUNCTION>
>
> > -----Original Message-----
> > From: Li Chunshen (Don) [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 1 January 2003 11:37 a.m.
> > To: CF-Talk
> > Subject: Request Time
> >
> >
> > specs: CFMX on WinXP Pro; remote datasources on
> Win2k
> > Pro.
> >
> > Requestimeout set to 40 seconds via CF admin
> (server
> > has been rebooted, my friend). Expect cf server
> to
> > throw requestimeout msg, better, gracefully,
> > regardless of the types of request. Problem, when
> > trying to connect to an unavailable remote
> datasource
> > (who can garanttee it's always available?),
> instead
> > of 40 seconds timeout, CFMX keeps on trying and
> trying
> > though asked otherwise, what's going on? With
> CF5, an
> > undocumented tag of Is_CFdatasource takes care of
> the
> > problem very well. Thanks.
> >
> > DL
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> > http://mailplus.yahoo.com
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm