cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Willerding <>
Subject Re: Database timeout questions
Date Wed, 12 Dec 2012 02:38:57 GMT
Thanks for the "old" advice.  ;-)   I will definitely try it although 
I'm not sure if the condition that created this situation may happen 
again on the Oracle server.  A lot of people have a lot of explaining to 
do to figure out what was going wrong.  Luckily I'm just a dumb client 
in this situation.

One more question though.  If it does work and the driver accepts the 
timeout value I set, what can I expect to happen when the timer 
expires?  Is there a specific exception I need to catch or a condition I 
need to check?


On 12/11/2012 02:33 PM, Andrus Adamchik wrote:
> 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]
> On Dec 11, 2012, at 5:57 PM, Andrew Willerding <> 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

View raw message