File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Query Time out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query Time out " Watch "Query Time out " New topic
Author

Query Time out

Manjesh Patil
Ranch Hand

Joined: Sep 24, 2010
Posts: 41

Hi ,
I am using Oracle JDBC Driver version - 9.0.2.0.0 in my JDBC based utility program.
the problem is when query takes more than 20-30 minutes to return the resuts ,I face "Time out" error.

I have tried printing getQueryTimeOut(); which will print '0' (Zero) I have read from JDBC API doc that Zero indicates Driver will wait for any amount of time once the query starts executing..
but still I do face this issue.
Even tried to setTimeout to some 30 minutes converting into seconds then also no gain.
can anyone tell me the workaround to this..

Thanks
Manjesh

Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
Are you getting a SQLException or some other timeout oriented exception?

If the query itself is timing out then you should be getting a SQLException with a relevant message. You said the timeout is set to zero so it should not be timing out at all. However, there could be some other network or session config that is timing you out. I actually experienced a situtation where we thought a query was timing out but it turned out that there was a network config (I forgot exactly what it was) set to timeout due to inactivity. This timeout period happened to be shorter than the average execution time of our query; SQLException was not thrown in this case cause the SQL timeout did not happen. After we bumped it a bit all was fine.

What is the actual exception message thrown?

BTW, if your query is taking 30 plus minutes you may want to consider tuning it and/or the tables or database involved.
Manjesh Patil
Ranch Hand

Joined: Sep 24, 2010
Posts: 41

Hi Ed Ward,
thanks for replay

There is no SQLException trace just it says :
WARNING: Read timed out
not able to figure out where is this time period is defined .
tuning the query wont help me lot coz Its reported that even after 5 minutes the warning message appears [WARNING: Read timed out]
I tried with query which will take 1-2 minutes that works fine ,problem is with the queries which will take 5+ minutes

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Query Time out