Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
grace chow
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chek wether u are storing more info than the capacity of blob
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JDBC forum...
 
nilesh Katakkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic