Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

conversion between CLOB/BLOB and String

 
Kenny Xu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,every one.
how to convert CLOB/BLOB of java API to String,
and String to CLOB/BLOB conversion?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kenny,
To get a String from a blob/clob, you can use blob.getBinaryStream() or clob.getAsciiStream(). It's just like reading from a file.
Creating a blob/clob can be done using the set versions of these methods. Many drivers also provide a constructor that takes a String parameter for convenience.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic