*
The moose likes JDBC and the fly likes insert blob into DB - row containing the LOB value is not locked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "insert blob into DB - row containing the LOB value is not locked" Watch "insert blob into DB - row containing the LOB value is not locked" New topic
Author

insert blob into DB - row containing the LOB value is not locked

grace chow
Greenhorn

Joined: Oct 25, 2004
Posts: 13
Dear neelesh Katakkar,
thanks so much ,, you are right, I solve the problem! Many thanks


Dear, I am insert an very large string called SIGNED_TEXT into database, I am converting the SIGNED_TEXT into blob data type in db., the following are my codes. but there is always error row containing the LOB value is not locked.. do you know what it means and how to solve it? thanks for ur attention

String sqlSignText= "select SIGNED_TEXT from STORE where STORE_ID ='" + STORE_ID + "'";
pstmt2= con.prepareStatement(sqlSignText);
ResultSet rset= (OracleResultSet) pstmt2.executeQuery();
if (rset.next()) {
BLOB blob= (BLOB) rset.getBlob("SIGNED_TEXT");
OutputStream outstream= blob.getBinaryOutputStream();
InputStream instream= new ByteArrayInputStream(SIGNED_TEXT.getBytes());
int count= 1, total= 0;
byte[] data= new byte[(int) instream.available()];
instream.read(data);
outstream.write(data);
instream.close();
outstream.close();
String sqlinsert= "insert into STORE values (SIGNED_TEXT) values (?) where STORE_ID = '" + STORE_ID + "'";
pstmt3= con.prepareStatement(sql);
pstmt3.setBlob(1, blob);
pstmt3.executeUpdate();




O ***************************************************************************************
[:812 CST04?9?10? 19?03?] 4815ac77 SystemOut O java.io.IOException: ORA-22920: row containing the LOB value is not locked
[ November 03, 2004: Message edited by: grace chow ]
rrmanthena raju
Greenhorn

Joined: Nov 01, 2004
Posts: 7
chek wether u are storing more info than the capacity of blob
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Moving to the JDBC forum...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
nilesh Katakkar
Ranch Hand

Joined: Oct 27, 2004
Posts: 35
To update blob you need to lock the row explicitly. Before executing this can you make sure connection.setAutoCommit(false) is set to false. The default is true, which means jdbc driver will treat every single statement as a new transaction. Let us know if this works.


nilesh<br />neilindallas@hotmail.com
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: insert blob into DB - row containing the LOB value is not locked
 
Similar Threads
Problem inserting Blob into Oracle DB
Getting error while saving image as blob in oracle
Unable to create many-to-one mapping
Problem updating BLOB
Inserting Picture