This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes help: lock problem during Clob update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "help: lock problem during Clob update" Watch "help: lock problem during Clob update" New topic
Author

help: lock problem during Clob update

holly wang
Greenhorn

Joined: Aug 28, 2003
Posts: 13
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

Joined: Aug 28, 2003
Posts: 13
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: help: lock problem during Clob update
 
Similar Threads
Convert large string to Clob
an example to insert data into Oracle Clob
String -> MySQL CLOB
The question about CLOB serialize? Thank you !!!
BLOB