wood burning stoves 2.0*
The moose likes JDBC and the fly likes store unicode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "store unicode" Watch "store unicode" New topic
Author

store unicode

teo peng
Greenhorn

Joined: Jul 16, 2001
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: store unicode
 
Similar Threads
How to store & retrieve a video file from database?
how to create BLOB and CLOB data
Need Help!! Storing valuse in a database
how to insert Chinese character into Hsqldb ?
Problem While storing Chinese Chars In db.