File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Locking a table for read Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Locking a table for read" Watch "Locking a table for read" New topic
Author

Locking a table for read

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I need to lock a table for reading through jdbc. Note that I am only performing a read (select) and I have no control over the database configuration. Is what I want to achieve still possible?

I use a standalone java app together with ibm db2 for as400.

Thanks in advance,

Julien.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

You should not need to lock a table for reading. Reading a record works without locking.
What is the reason that you have this requirement?



Some databases allow you to lock when you do a It doesn't guarantee that you have a row, segment, or table lock. You will have to properly release the lock (by closing the transaction). Read your database's documentation on the 'for update' clause, and if it does what you want.


OCUP UML fundamental and ITIL foundation
youtube channel
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Thanks a lot for the reply!
All the best,
Julien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Locking a table for read
 
Similar Threads
hex to String Help!!!!!!!!!!!!!!!!!!!!
make db table read only
change the column type
How to ensure a read-only table will never be locked?
return as xml document