Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting lock timeout

 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys... im using MS SQL 2000. Is there a way in java to set the lock timeout?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JP,
Which locks? The database locks?
 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic