[ 
http://issues.apache.org/jira/browse/DERBY-506?page=comments#action_12331714 ] 

Oyvind Bakksjo commented on DERBY-506:
--------------------------------------

Sending the EXCSQLSET when the JDBC call [to Statement.setQueryTimeout()] is 
made would cause an additional round-trip between the client and the server, 
which is what I was trying to avoid by piggybacking the execute flow. Are you 
concerned with the extra bytes sent during the execute call? For a prepared 
statement, we only need to transmit the timeout once; for the first execute (or 
if the timeout is changed with a subsequent call to setQueryTimeout() on the 
client side). In code like the example below, we would only need to piggyback 
the execute message for the first iteration, thus avoiding both an extra 
round-trip and message overhead.

PreparedStatement ps = connection.prepareStatement(SQL);
ps.setQueryTimeout(TIMEOUT);
while (condition) {
    ps.execute();
    ....
}

Have I understood you correctly, or do you have other concerns that makes you 
prefer transmitting the timeout at the JDBC call time? By the way, is that 
viable for unprepared statements (the server does not yet know about the 
statement for which the client sets a timeout)?

> Implement Statement.setQueryTimeout in the Client Driver
> --------------------------------------------------------
>
>          Key: DERBY-506
>          URL: http://issues.apache.org/jira/browse/DERBY-506
>      Project: Derby
>         Type: New Feature
>   Components: JDBC
>     Versions: 10.1.1.0
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>  Attachments: DERBY-506_PRE.diff
>
> Currently, the Embedded Driver supports Statement.setQueryTimeout(), but the 
> Client Driver does not. The Client Driver should be enhanced and match the 
> Embedded Driver.
> For this, we need to transfer the timeout value from the client to the 
> server, preferably without a separate round-trip. I have some loose thoughts 
> on how to do this:
> * If the client has set a timeout value for a statement, prepend the (DRDA) 
> EXCSQLSTT command with an EXCSQLSET command which contains the timeout value; 
> conceptually a "SET STATEMENT TIMEOUT <seconds>" (this does not mean that we 
> need to extend the Derby grammar; only the Network Server needs to understand 
> this DRDA EXCSQLSET command).
> * In DRDAConnThread.parseEXCSQLSETobjects() on the server side, recognize the 
> "SET STATEMENT TIMEOUT" text, parse the timeout value and remember it for the 
> coming EXCSQLSTT command. Do NOT invoke executeUpdate() with the SET 
> statement [see note below].
> * In DRDAConnThread.parseEXCSQLSTT(), check if a timeout value has been set; 
> if so, use it (by setting the timeout value on the server-side Statement 
> object before calling execute/executeQuery). 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to