• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Some questions on "select for Update"

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic