• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Storing large String in CLOB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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).]
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic