Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the error?thanks!

 
jsy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public String WriteClob(String text)throws Exception{
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection sqlcon=DriverManager.getConnection("jdbc racle ci8:@abcd","system","manager");
Statement sqlstmt=sqlcon.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String strsql="select content from mytable where id=1000 for update";
ResultSet rs=sqlstmt.executeQuery(strsql);
if(rs.next()){
oracle.sql.CLOB clob=((oracle.jdbc.driver.OracleResultSet)rs).getCLOB("content");
Writer writer=clob.getCharacterOutputStream();
writer.write(text);
writer.flush();
writer.close();
}
sqlstmt.close();
sqlcon.close();
return "Success!";
}
first,it is sure that there is the record which id=1000.
The CLOB length is displayed when i add the statement "System.io.print(clob.length());" after the statement "clob=((oracle.jdbc.driver.OracleResultSet)rs).getCLOB("content");"
Who do help me ?
 
Rahul Mahindrakar
Ranch Hand
Posts: 1868
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic