• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Storing large String in CLOB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to store large string (> 4000 Characters)in Clob data column of Oracle database. I tried,,,,
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT clobData from myTable");
rs.next();
oracle.sql.CLOB xClob = rs.getClob(1); //works fine
OutputStream os = xClob.getAsciiOutputStream();
//I've to store String m_procedureText;
os.write(m_procedureText.getBytes());
os.flush();
os.close();
The compiler is throwing the following exception:
ROW containing the LOB value is not locked
>>Any suggestion regarding how to lock the ROW before updating its CLOB column.

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the lines u need to add before creating statement ..
1. set the sutocommit mode to false.
connection.setAutocommit(false);
and
2. if u r going to update the column then use select for update query to lock the row.
like this
select col from table for update.
hope it will help
if any errors please post them

Originally posted by Syed Naeem:
I'm trying to store large string (> 4000 Characters)in Clob data column of Oracle database. I tried,,,,

Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT clobData from myTable");
rs.next();
oracle.sql.CLOB xClob = rs.getClob(1); //works fine
OutputStream os = xClob.getAsciiOutputStream();
//I've to store String m_procedureText;
os.write(m_procedureText.getBytes());
os.flush();
os.close();
The compiler is throwing the following exception:
ROW containing the LOB value is not locked
>>Any suggestion regarding how to lock the ROW before updating its CLOB column.


 
Syed Naeem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also tried it with UPDATE statement, but doesnt help. The, "SELECT columnName from tableName for UPDATE" statement works in sqlplus, but not through JDBC3.0.
the lines u need to add before creating statement ..
1. set the sutocommit mode to false.
connection.setAutocommit(false);
and
2. if u r going to update the column then use select for update query to lock the row.
like this
select col from table for update.
hope it will help
if any errors please post them

quote:
--------------------------------------------------------------------------------
Originally posted by Syed Naeem:
I'm trying to store large string (> 4000 Characters)in Clob data column of Oracle database. I tried,,,,
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT clobData from myTable");
rs.next();
oracle.sql.CLOB xClob = rs.getClob(1); //works fine
OutputStream os = xClob.getAsciiOutputStream();
//I've to store String m_procedureText;
os.write(m_procedureText.getBytes());
os.flush();
os.close();
The compiler is throwing the following exception:
ROW containing the LOB value is not locked
>>Any suggestion regarding how to lock the ROW before updating its CLOB column

[This message has been edited by Syed Naeem (edited June 24, 2001).]
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic