Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes jdbc FOR UPDATE clause limitation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc FOR UPDATE clause limitation" Watch "jdbc FOR UPDATE clause limitation" New topic
Author

jdbc FOR UPDATE clause limitation

Steve Dambrosio
Greenhorn

Joined: Apr 02, 2009
Posts: 28
Howdy - love your website... I'm having a problem with a jdbc limitation that is pretty common based on researching other posts; however I haven't been able to find a workaround or solution! Perhaps you can point me to a posting that solves this problem or help me directly. It all started out with this from the Oracle JDBC manual:

FOR UPDATE Clause Limitation in an Updatable Result Set
A query cannot have the FOR UPDATE clause in the SELECT statement if you are
using an updatable result set. If you use the FOR UPDATE clause and try to update a
result set, an SQLException will be thrown.

(BTW, the exception is the mysterious "missing parenthesis" message that you know all too well).

I want to lock a row for the duration of a transaction. The only solution I was able to find was to use a positioned update: UPDATE... WHERE CURRENT OF cursor. That would be perfect and is the technique I use in other languages. But that doesn't work because it's not supported by my driver! Now I'm stuck. What I'm doing is very, very normal and common so there must be a solution. Thanks.





 
Consider Paul's rocket mass heater.
 
subject: jdbc FOR UPDATE clause limitation