> how to write a jdbc code that should store image object in the database
If you're storing it as a BLOB, use PreparedStatement.setBinaryObject(),
passing a class derived from InputStream, something like a
ByteArrayInputStream, or FileInputStream, as the parameter.

Signature
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
Lee Fesperman - 22 Jun 2007 08:29 GMT
> > how to write a jdbc code that should store image object in the database
> >
> If you're storing it as a BLOB, use PreparedStatement.setBinaryObject(),
> passing a class derived from InputStream, something like a
> ByteArrayInputStream, or FileInputStream, as the parameter.
ITYM, PreparedStatement.setBinaryStream().
Alternatively, you can use an array of bytes and
PreparedStatement.setBytes(). Or, you can use
PreparedStatement.setBlob() if your DBMS provides an implementation of
java.sql.Blob on the client side.
--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)
On Wed, 20 Jun 2007 09:36:51 -0000, ramana praharaju
<ramana.8@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>how to write a jdbc code that should store image object in the database
You first of all have to convert it to an platform independent format
such as JPG or PNG. See http://mindprod.com/jgloss/jpgencoder.html
http://mindprod.com/jgloss/pngencoder.html
now you have an array of bytes. This can be stored in a database as a
BLOB type.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com