Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting Lock Timeout for DB2 on AS400

843859Aug 11 2009 — edited Nov 20 2014
Hello,

I am developing java application that connect to DB2 on AS400 server.
I am using com.ibm.as400.access.AS400JDBCDriver JDBC driver.

I want to set the lock time out to 10 sec, means that id user A locks a record, user B that try to lock the same record will wait at most 10 sec until an exception will be thrown or the lock will be released.

I try the following things:

1)
java.util.Properties prop = new java.util.Properties();
			prop.put("user", dbUser);
			prop.put("password", dbPassword);
			prop.put("currentLockTimeout" , 10);   // I use also the propery name lockTimeout instead of currentLockTimeout
			Connection connection = DriverManager.getConnection(this.getDbUrl(), prop);
2) execute
SET CURRENT LOCK TIMEOUT NOT WAIT
sql or
SET CURRENT LOCK TIMEOUT WAIT 10
3) concat the db url the string "{code};locktimeout=10{code}"

Nothing of my tries were successful.

Is ther any idea ???

thank,
Tomer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2009
Added on Aug 11 2009
3 comments
751 views