Helpful Information
 
 
Category: Java Help
String to Clob conversion

Hi !

I have one problem in Oracle database. The size of the string i use exceeds 4000 character, so varchar2 type cannot be used. Can any one tell me with a simple example of how to convert a string of such type to a Clob type and store in database and on retrieval, convert it back to string?.

Thanks in advance.
swarna

Hi !

I have one problem in Oracle database. The size of the string i use exceeds 4000 character, so varchar2 type cannot be used. Can any one tell me with a simple example of how to convert a string of such type to a Clob type and store in database and on retrieval, convert it back to string?.

Thanks in advance.
swarna

Do you need the conversion stuff in Oracle native functions or other language stuffs

http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/rowset/serial/SerialClob.html
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html#setClob(int,%20java.sql.Clob)
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#getClob(java.lang.String)

...etc.

It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of online documentation (http://java.sun.com/javase/reference/api.jsp) that you can even download (http://java.sun.com/javase/downloads/index.jsp) for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.

Java™ API Specifications (http://java.sun.com/javase/reference/api.jsp)
Java™ SE 6 JDK Javadocs (http://java.sun.com/javase/6/docs/api/)

Best of luck!

~










privacy (GDPR)