Interesting. I might trying using the timeout before resorting to the nested
try/catches. 




-----Original Message-----
From: Wil Genovese [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 12, 2007 12:46 PM
To: CF-Talk
Subject: Re: CFQuery wrapper tag to help with poor connections to sql..


Also remember the timeout attribute for cfquery.  It accepts integers as
seconds.

<cfquery name="users" datasource="#myDSN#" timeout="2">
        SELECT user_id FROM users
</cfquery>


--
Wil Genovese

One man with courage makes a majority.
-Andrew Jackson

A fine is a tax for doing wrong. A tax is a fine for doing well. 



Rich wrote:
>> I have an app that has to use a connection that sees a few seconds of 
>> disconnectivity from its SQL server occasionaly.
>>     
>
> Dan,
> You can nest CFTRY's to accomplish this.
>
> Something like:
>
> <cftry>
>       
>       <cfquery name="users" datasource="#myDSN#">
>               SELECT user_id FROM users
>       </cfquery>
>
>       <cfcatch type="database">
>               <!--- 
>                 This could be our timeout issue, 
>                 sleep for 2 seconds and try again
>               --->
>               <cfset thisThread = CreateObject("java", "java.lang.Thread")
/>
>               <cfset thisThread.sleep(2000) />
>               
>               <cftry>
>                       <cfquery name="users" datasource="#myDSN#">
>                               SELECT user_id FROM users
>                       </cfquery>
>                       
>                       <cfcatch type="any">
>                               <!--- 
>                                 Rethrow the error as we cannot recover
>                               --->
>                               <cfrethrow /> 
>                       </cfcatch>
>               </cftry>
>       </cfcatch>
> </cftry>
>
> HTH,
>
> Rich
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288363
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to