Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC BLOB locking question?

Re: JDBC BLOB locking question?

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Sat, 30 Sep 2000 02:29:00 GMT
Message-ID: <39D5500F.C85EE19@rationalconcepts.com>

Hi Mike,
  I'm not quite sure how you got the code to work. Maybe you have a typo.   Anyway, to update the blob, you should be doing    "select iodata from miketable where userid = 100 FOR UPDATE"    (and probably with a NOWAIT option)

  See Oracle docs on select ... for update explanation.   In short, this has locked the row until you have finished your transaction (commit).
  No one else can update while you have the lock.

  hth,
cindy

myarch5_at_hotmail.com wrote:

> i am using blob with jdbc and i've gotten it to work, but
> my question is with locking....i'm wondering if i'll have a
> syncronization issue since it's not one nice and easy "update"
> transaction with a blob...here's my general code
>
> table miketable (
> userid varchar2(10),
> timestamp date,
> iodata blob;
>
> rslt=stmt.executeQuery("SELECT iodata FROM miketable WHERE userid=100");
> rslt.next();
> inBlob = ((OracleResultSet)rslt).getBLOB(1);
> inStream = inBlob.getBinaryStream();
>
> - read from stream here
> - manipulate blob
>
> executeUpdate("UPDATE miketable set timestamp = sysdate");
> rslt=stmt.executeQuery("SELECT iodata FROM miketble WHERE userid =100");
> rslt.next();
> outBlob = ((OracleResultSet)rslt).getBLOB(1);
> outStream = outBlob.getBinaryOutputStream();
>
> -write blob to database
>
> I'm concerned that "updating" a blob is not just a nice an easy one
> step transaction....so, inbetween, i'm wondering if another db process
> could update the record??? i call a second time for the blob
> handle (after the update) just incase if the handle has been chaned
> from the update....i'm not sure if i really need to do this....but
> i still have the multi-step transaction issue.
>
> mike
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Sep 29 2000 - 21:29:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US