This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Some questions on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Some questions on "select for Update"" Watch "Some questions on "select for Update"" New topic
Author

Some questions on "select for Update"

Joe Joseph
Greenhorn

Joined: Jun 21, 2006
Posts: 20
Hi All,

I have some questions on "select for Update"
1. If i do a "select for Update" on a table for a row (row identified by the key) & i donot do any update or commit or rollback, will the row stay locked for ever?
2. If i do "Select col1 from TAble1 for Update where..... ".
In this case is only col1 for that row being locked, or is the whole row being locked?

Please note that Database involved in Oracle.. And the server side code is in Java
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
It will be "row" lock in oracle. You can't lock just one column. And regarding the other question on record being locked when you don't perform any operation, the JDBC/SQL connection will timeout at some point either based on the DB server or JDBC setting and the JDBC driver will implicitly either "rollback" or "commit" based on the JDBC driver type (XA & Non XA connection). There is no way you will end up locking the row forever.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some questions on "select for Update"
 
Similar Threads
INSERT INTO SELECT FROM
reading BLOB data from oracle
LockMode.UPGRADE in Hibernate
some questions about EJBQL
Select and update on the same table