Hey!

This is off-topic for SERVLET-INTEREST list.

Why go through all of this bother.

Sudarson Roy Pratihar wrote:

> As a matter of fact, in my application the need is bit different. The web 
>application permits the user to upload the file which is to be  finally stored as 
>BLOB in oracle database. So if I can directly get the handle to the output stream of 
>Filepart, it could be easier for me rather than storing it in temp location then 
>reading it and storing as BLOB and then delete the temp file.
>

Just stream it into a BLOB or CLOB and be done with it.  I do this all
of the time.

If your database supports JDBC 2.0, BTW Oracle doesn't wrt LOBs.

Do this:

PreparedStatement pstmt = new PreparedStatement("insert into blob_table (blob_col)");
pstmt.setBinaryStream(1,your_inputStream,lengthFile);    //for BLOB
pstmt.setAsciiStream(1,your_inputStream,lengthFile);    //for CLOB
pstmt.execute();

Wham, bam, boom, thank you mam.

But like I said, this doesn't work for Oracle, for their JDBC 2.0 driver has a bug.
Use a differant database or contact Oracle directly.  I have no problem with this
method using IBM's DB2.

Sans adieu,
Danny Rubis

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to