aspose file tools*
The moose likes JDBC and the fly likes problem uploading file in oracle databse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem uploading file in oracle databse" Watch "problem uploading file in oracle databse" New topic

problem uploading file in oracle databse

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809

I have a requirement where I have to store files of following formats in oracle database as a Blob.

File Formats are: .txt, .rtf, .doc, .xls, .pdf, .gif, .jpeg, .png.

Technologies which I am using are flex, spring and hibernate. Backend is oracle with thin driver. System allows user to choose file from flex mxml page, it makes a HTTPService call to a servlet where I am getting inputstream object from the request.

Now my question is how do I use this inputstream object with blob.

I know if I can do it by writing simple jdbc code then I can do the same by hibernate.

Few ways which I found from google are:

1. insert a empty_blob() in that column,
2. load that column to get its pointer. Get it from ResultSet
3. Read byte from inputstream and write it in the outputstream pointing to the blob column.

I am able to write the data in the database column by above approach but not more than 3 kb. I don't know what is the problem. In my case file size is maximum 12 MB.

Second approach which I got from google is by class SQLUpdate. But it did not work.

Please help me guys.

Waiting for your reply

[ August 26, 2007: Message edited by: Naseem Khan ]

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
I agree. Here's the link:
subject: problem uploading file in oracle databse