This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
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

isWritable vs isDefinatelyWritable

 
Galen Benson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain to me the difference in the ResultSetMetaData class between the isWritable vs isDefinatelyWritable? I'm in a class and none of us can figure out what the specific differences are. We are using DB2.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Galen,
Let's start with the API from the JavaDoc:
isDefinitelyWritable - Indicates whether a write on the designated column will definitely succeed.
isWritable - Indicates whether it is possible for a write on the designated column to succeed.

The difference has to do with database locks. For isDefinitelyWritable(), I must already have a write lock to guarantee that the write will succeed. For isWritable(), it is sufficient that nobody else has a write lock so it at least possible for the write to succeed. isWritable() is more like a method to check that a write will not definitely fail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic