coldfusion datasource that is not in administrator code example

Example: coldfusion get datasource information

<cfobject action="CREATE" type="JAVA" class="coldfusion.server.ServiceFactory" name="factory">
<cfset cfdebugger = factory.getDebuggingService()>
<cfset qEvents = cfdebugger.getDebugger().getData()>

<cftry>
    <cfquery dbtype="query" name="cfdebug_qryDSN">
        SELECT DISTINCT DATASOURCE FROM qEvents WHERE type = 'SqlQuery'
    </cfquery>
    <cfcatch type="Any">
        <cfset cfdebug_qryDSN = queryNew('DATASOURCE')>
    </cfcatch>
</cftry>

<cfdump var="#cfdebug_qryDSN#" label="cfdebug_qryDSN">

Tags:

Misc Example