• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

help: lock problem during Clob update

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on insert a string into a oracle Clob object, after I insert empty_clob() into the clob field, I try to lock it for further process:

//create table test (id integer,content clob);

String sql="insert into testTable values(1,empty_clob())";
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
String sqll="select content from test where id=1 for update";
ResultSet rss=stmt.executeQuery(sqll);
if(rss.next()){
CLOB clob = ((OracleResultSet)rss).getCLOB(1);
clob.putString(1,"ddddddddddddddddddddddddddddddddddd");
sql="update test set content=? where id=1";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
pstmt.close();
}
 
holly wang
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am working on insert a string into a oracle Clob object, after I insert empty_clob() into the clob field, I try to lock it for further process:
//create table test (id integer,content clob);
String sql="insert into testTable values(1,empty_clob())";
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
String sqll="select content from test where id=1 for update";
ResultSet rss=stmt.executeQuery(sqll);
if(rss.next()){
oracle.sql.CLOB clob = (oracle.sql.CLOB)rss.getCLOB(1);
clob.putString(1,"ddddddddddddddddddddddddddddddddddd");
sql="update test set content=? where id=1";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
pstmt.close();
}
Does anybody knows why when the system come to "if(rss.next())" then it just freeze it? I can't go on whatever I do. Please help me, this is such a pain
 
get schwifty. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic