Skip to main content
zenashok
Participant
November 20, 2015
Question

ColdFusion11 Mobile - Datasource wont work the same for WEB and cfclient

  • November 20, 2015
  • 1 reply
  • 292 views

I have an oracle data source which works fine in a web app but wont work if I write a cfquery inside a cfclient. I would like to know what the problem is or is it a bug.

index.cfm:


   <div id="actual_1"></div>

  <cfclientsettings  enableDeviceAPI = "false"  detectDevice = "false" > 
  <cfclient>
   <cftry>
    <cfinvoke component="querydb" method="getDbdetails" returnvariable="variables.ServerForms"> </cfinvoke>
         <cfset document.getElementById("actual_1").innerHTML+=variables.ServerForms>
    <!---<form action="listcsar.cfm" method="post">

     <input type="submit" value="View my CSAR">    
    </form>--->
    <cfcatch>
     <cfset document.getElementById("actual_1").innerHTML+= cfcatch.message & "<BR>">
    </cfcatch>
    </cftry>
    <cfset document.getElementById("actual_1").innerHTML+="DONE" & "<BR>">

  </cfclient>
 

QueryDB.cfc:

<cfcomponent >

<cffunction name="getDbdetails" access="remote"  returntype="numeric" >

     <cfquery name="tst" datasource="DEVTRY1" result="rr1">

    SELECT count(*) as counts FROM SECURITY.REQS

   </cfquery>

  <cfreturn tst.recordcount>

</cffunction>

</cfcomponent>

    This topic has been closed for replies.

    1 reply

    Dave Ferguson
    Participating Frequently
    November 20, 2015

    Can you define "Won't work".  Are you getting an error message or something else that you can share?

    --Dave

    zenashok
    zenashokAuthor
    Participant
    November 20, 2015

    Dave, I get a error message - Cannot read property 'variables' of null. Its basically unable to connect to the same database.

    I Write a query without CFCLIENT for the same DB it works but it fails if I write it inside CFCLIENT.