• 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

store unicode

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai;
I am a new java programmer. I have facing the problem how to store >4kb unicode data to my oracle8i database in nclob datatype, when i try to use the following statement:
String query = "INSERT INTO CHINESE (" +
"id, b" +
") VALUES (1, n'" + temp + "')";
ResultSet uprs = stmt.executeQuery(query);
uprs.close();
where temp is a string and containt the unicode data >4kb. But if i use that statement to insert 'temp' in < than 4kb that is no problem, and the result also can select out from database by JDBC.
I also try in convert the string 'temp' to clob data insite the java program for the following insert statement, but i do not know how to convert and do not know wherever this is the correct way or not.:
OraclePreparedStatement ops = (OraclePreparedStatement)con.prepareStatement
("INSERT INTO CHINESE (id, b) VALUES(?,?)");
ops.setInt(1, 9);
ops.setCLOB(2, oClob);
ops.execute();
This statement can run, but the data inserted for the b fied in database is empty because the oClob is empty. So, have somebody know how to convert the string 'temp' to oClob?
Also, have some body know how to solve one of these problems please give a help. Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic