• 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
Sheriff
Posts: 36027
431
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.
 
rubbery bacon. rubbery tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!