My 2 cents: You'd be crazy to do it in straight java. If you do,
you'll need to ensure you close your resultsets, statements and
connections. And when you close your resultsets... you can't loop over
them. In addition, the Flags you pass to your connection matter. If
you want to scroll backwards and forwards (to get record count, for
example), you need to pass the appropriate flags. And they will slow
down your queries considerably. In addition, unless there's some magic
with working with java ResultSet objects in CF, you'll still be stuck
with:

resultset.getString() and resultset.getInt() and that ugliness.

There's a reason java developers use Hibernate instead of straight
JDBC... it's that straight JDBC sucks to work with.



On Tue, Nov 25, 2008 at 12:36 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hey CF Guys,
>
> I have executed a query with CFQuery Tag and then with CF Java
> classes. Below is the matrix for performance.
>
> I  have executed query for 14 times, Average time for query is as
> below.
>       ---With CFQuery Tag =  748.714
>       --- With Java Classes = 769.14
>
> But the good thing about executing query with Java Objects, It tooks
> more seconds for initial  4-5 times and after that it was taking less
> time than CFQuery tag.
>
> I want to know your thoughts for this.
>
> -------------- Code ----
> <cfset dsn=#application.dsn#>
>    <cfset value= 1326231>
>
>
>    <!--- executing query with <cfquery> Tag ---->
>    <cfset tickBegin = GetTickCount()>
>
>    <cfquery name="q" datasource="#dsn#">
>     {CALL myStoredProc (
>                    <cfqueryPARAM value = "#value#" CFSQLType =
> "CF_SQL_INTEGER">
>    )
>   }
>  </cfquery>
>
>    <cfset tickEnd = GetTickCount()>
>
>  <cfset QueryTime = tickEnd - tickBegin>
>
>    <cfoutput>
>     QueryTime : #QueryTime#
>    </cfoutput>
>
>  <br />
> ---------------------------------------------------------------- <br /
>>
>  <!--- executing query with Java object ---->
>  <cfset sqlst="">
>  <cfset sqlst= sqlst & "exec Get_Patient_Header ">
>  <cfset sqlst= sqlst & "" & value & "">
>
>  <cfset tickBegin = GetTickCount()>
>
>  <cfscript>
>  objResults2 = CreateObject(
>  "java",
>  "coldfusion.sql.QueryTable"
>  ).Init(
>  CreateObject(
>  "java",
>  "coldfusion.server.ServiceFactory"
>  ).DataSourceService.GetDataSource(
>  "DSN_DEV"
>  ).GetConnection().PrepareStatement( sqlst).ExecuteQuery()
>  );
>    </cfscript>
>  <cfset tickEnd = GetTickCount()>
>
>    <cfset QueryTime = tickEnd - tickBegin>
>
>  <cfoutput>
>     QueryTime : #QueryTime#
>    </cfoutput>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to