File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading BLOB data from oracle

 
rakkesh kumar
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it mandatory to lock the row while inserting the data in to BLOB column.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakkesh,
Not the whole row. And the driver will take care of this for you.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think the driver will takecare of locking stuff. Oracle has a locking mechanism in there.

anyways, you need not do it explicitly.
 
rakkesh kumar
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have locked the row using below Sql statement.

SELECT DATA FROM BLOBDATA WHERE id = ? FOR UPDATE


if i'm not doing it it is giving error like the row is not locked.

if i do this it's working properly
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakkesh,
The reasons for that is because you are doing multiple things in the same transaction. The row needs to be locked to make sure the data you are retieving is consistent with the data you are adding. Otherwise someone could change things in the middle and leave your data in an inconsistent state.

If you were just inserting the BLOB, the locking situtation would be different.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic