wood burning stoves 2.0
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "conversion between CLOB/BLOB and String" Watch "conversion between CLOB/BLOB and String" New topic

conversion between CLOB/BLOB and String

Kenny Xu

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

Joined: May 26, 2003
Posts: 33102

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: conversion between CLOB/BLOB and String
It's not a secret anymore!