File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc FOR UPDATE clause limitation" Watch "jdbc FOR UPDATE clause limitation" New topic

jdbc FOR UPDATE clause limitation

Steve Dambrosio

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.

I agree. Here's the link:
subject: jdbc FOR UPDATE clause limitation
It's not a secret anymore!