0

i am using the below code for creating the connection to database.

connectionURL = "jdbc:oracle:thin:@//testdsfsdfgs:1521/TEST";
conn = DriverManager.getConnection(connectionURL, userName,Password);

i want to set the transaction time out. How can i do that.

Please some one help.
Thanks in advance

3
Contributors
5
Replies
20
Views
4 Years
Discussion Span
Last Post by Vinodh_1
0

Tranaction timeout means complete round of time from creating the connection-executing the queries-disconnecting.

0

Actually i have to execute one query which will take an average of 2sec. what ever time it takes for querying, i should end teh connection in 6 seconds.

0

Presumably you could start a java.util.Timer when you start the query, then when the Timer expires after 6 seconds its TimerTask could call Connection's abort method to terminate the connection (which in turn will abort the query with a SQLException). It's a bit crude, but should work.

0

Thanks for your reply.

As i could see only query level time out is sufficient.
If i can able to do it with oracle options in the connection URL or with Properties then fine. 

Edited by Vinodh_1: just

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.