wood burning stoves 2.0*
The moose likes JDBC and the fly likes setting lock timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "setting lock timeout" Watch "setting lock timeout" New topic
Author

setting lock timeout

JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
hi guys... im using MS SQL 2000. Is there a way in java to set the lock timeout?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

JP,
Which locks? The database locks?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
yes database locks... i read somewhere that you can set through the connection string. something like:

jdbc:microsoft:sqlserver://111.22.4.12:1234;DatabaseName=testlab;selectMethod=cursor;lockTimeout=100


But is there a way in java to trap a database lock? If the lock times out will it throw an exception?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

Originally posted by JP Estrada:
But is there a way in java to trap a database lock?

I don't know of a way to do that. This doesn't mean it is impossible of course, just not common.


If the lock times out will it throw an exception?

Yes. You will get a SQLException for any type of database problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting lock timeout
 
Similar Threads
Difference bet wait(milisec) and sleep(milisec)
How to remove locks if client has failed to do so?
URLyBird Locking Queries
YAHOO...... I Made it.... 146/150
Help on lock and unlock methods design