It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes setting lock timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32501
    
214

JP,
Which locks? The database locks?


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32501
    
214

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: setting lock timeout
 
It's not a secret anymore!