wood burning stoves*
The moose likes JDBC and the fly likes conversion between CLOB/BLOB and String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "conversion between CLOB/BLOB and String" Watch "conversion between CLOB/BLOB and String" New topic
Author

conversion between CLOB/BLOB and String

Kenny Xu
Greenhorn

Joined: Mar 24, 2004
Posts: 2
hello,every one.
how to convert CLOB/BLOB of java API to String,
and String to CLOB/BLOB conversion?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Moving this to the JDBC forum.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
GeeCON Prague 2014
 
subject: conversion between CLOB/BLOB and String