cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Database timeout questions
Date Tue, 11 Dec 2012 19:33:09 GMT
At the JDBC level timeout can be controlled via Statement.setQueryTimeout(..). However YMMV
between different DBs and drivers. Don't have much recent Oracle experience, but if Oracle
driver happens to support this API, you can use this old advice [1] which is still applicable.
Moreover if you have any success with it, please open a Jira and we'll integrate it in the
basic Cayenne SelectQuery.

Still your description sounds odd. If there is problem with a query on the Oracle side, I
would expect an exception. Though fwiw Oracle driver has always been an odd one among all
the DBs supported by Cayenne.

Andrus 

[1] http://cayenne.195.n3.nabble.com/query-timeout-needed-td1070.html

On Dec 11, 2012, at 5:57 PM, Andrew Willerding <awillerding@itsurcom.com> wrote:

> I had a situation yesterday that I didn't expect and therefore didn't handle correctly.
 My code is executing a Stored Procedure on an Oracle DB using the performGenericQuery method.
 The problem was that the Oracle server was not responding to the stored procedure and the
eventually the query returned "successfully" with an empty result.  I was expecting some sort
of exception to be thrown (like a timeout) in this situation but it definitely was not the
case.  I currently measure the transaction time and the empty response was returning consistently
 at 60 seconds - it normally takes less than 2 seconds.  I am not sure if this 60 second timeout
is set on the Oracle server or somewhere in the Cayenne connection.
> 
> I have three questions:
> 
> 1)  Is there a way to set a timeout value within the Cayenne connection, or better yet,
an individual query to force a timeout exception if a response is not received within a certain
period of time?
> 
> 2)  Assuming the timeout is triggered from the Oracle server for the situation I describe
above, other than examining the timeout value within my code, is there a way to differentiate
between a successful transaction and one where the DB server times out and returns an empty
result set?
> 
> 3)  Assuming that the answer is "no" to both questions 1 & 2, is there a way to "kill"
a query in order to release the DB connection and return it to the pool?
> 
> I am using V3.0.2.
> 
> Thanks,
> 
> Andrew

Mime
View raw message