A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
I/O and Streams
How do you convert an stream in to Blob data?
Joined: Oct 11, 2008
Sep 03, 2009 10:20:28
We have a Blob Datatype in SQL db and the
equivalent is present in java.sql.Blob,
I basically want to convert the File in to Blob and then insert it in DB.
how do we do that??
Joined: Oct 27, 2005
Sep 03, 2009 13:28:51
driver is fully up-to-date, you can create a blob using Connection.createBlob(). You can then use setBinaryStream(0) to retrieve an
to which you can start writing.
If the JDBC driver does not allow you to create Blob instances this way, you can always use PreparedStatement and its setBinaryStream methods.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
It is sorta covered in the
JavaRanch Style Guide
subject: How do you convert an stream in to Blob data?
byte to blob
need to read the blob and convert it into a file
How to convert "java.sql.Blob" object to "java.sql.Clob" object?
vvvv urgent - Scanning and saving documents into oracle db with Twain
How to convert an object into BLOB
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014