wood burning stoves 2.0*
The moose likes JDBC and the fly likes Inserting Large objects into Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inserting Large objects into Database" Watch "Inserting Large objects into Database" New topic
Author

Inserting Large objects into Database

lakshmi vasavi
Greenhorn

Joined: Aug 31, 2009
Posts: 4
I need to insert a PDF of size 800 kb into oracle data base, using Java
I tried set Bytes and set Binary stream. It seems both of them do not support this size of 800 kb.
When i get a blob and try to use SetBytes(), I am getting this exception:
"java.sql.SQLException: Unsupported feature"
Please help..
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

Hi Lakshmi,

Welcome to the Java ranch ...

You have to use BLOB for this...

try to use SetBytes(), I am getting this exception:


Check when you are setting value SetBytes() the contains you set is in form of Binary ?


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
lakshmi vasavi
Greenhorn

Joined: Aug 31, 2009
Posts: 4
How do i create a BLOB? I have the contents in the form of byte array and input stream..
I have been trying to create BLOB but was not able to do
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

Hi Lakshmi,

I give you some link which will give you some idea about upload file and retrieve it from database ....

Store document to Database

http://forums.sun.com/thread.jspa?threadID=5329539

Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874





Integer.MAX_VALUE can handle 2 GB of data.
lakshmi vasavi
Greenhorn

Joined: Aug 31, 2009
Posts: 4
If i give Max_Value, I am getting java.lang.OutOfMemoryError error.
If i give the size of input stream as parameter for setBinaryStream, I am getting an RT exception saying "Data size bigger than max size for this type: 68823"
68823 is the lenght of the stream that i am trying to store in the data base.

Can i pass any other value for setBinaryStream?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



"Data size bigger than max size for this type: 68823"
68823 is the lenght of the stream that i am trying to store in the data base


Where do you set that ? I guess it would be better to share the jdbc piece of code.
 
jQuery in Action, 2nd edition
 
subject: Inserting Large objects into Database