I'm trying to write a small cfc that I can use to check on a DSN 
(datasource). 

I basically want to submit the DSN name as an argument to the function and 
get a json formatted response with a simple status boolean value being 
returned. I created an empty table in each database named 'isAlive' so I 
could do a basic select * on it. 

I'm just curious if this is this the best way to go about it. 

Example of function in use

<cfset results = application.functions.checkDSN(datasource="myDSN")>

CFC Code

  <cffunction name="checkDSN" returntype="boolean" output="no" 
access="remote" returnformat="json">
 
    <cfargument name="datasource" type="string" required="true" default="" 
hint="d" />
    
    <cftry>

  <cfquery name="dbcheck" datasource="#arguments.datasource#">

        SELECT *

FROM isAlive

      </cfquery>

      <cfreturn true> 

      <cfcatch type="Any">
        <cfreturn false> 
     </cfcatch>

    </cftry>
  
    <cfsetting showdebugoutput="false" />

   </cffunction>

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to