GeeCON Prague 2014*
The moose likes JDBC and the fly likes Image insertion into database through JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Image insertion into database through JDBC

Gvn Karthik
Greenhorn

Joined: Feb 07, 2011
Posts: 22
What is the maximum size of an image that can be stored in Oracle database in the form of BLOB or CLOB?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

You would of course use BLOB to store images. Image is a binary data, storing it in CLOB might render it unusable due to various conversions CLOB is subject to.

That said, maximum size of LOB objects differs a bit among different versions. As far as I'm aware it was at least 4 GB in Oracle 8 and much more (depends on the database block size, but generally counted in TB) in later versions. The size limit applies regardless of what type of data you actually put in. Anyway, you're probably not going to have image so large as not to be able to put it there.
Gvn Karthik
Greenhorn

Joined: Feb 07, 2011
Posts: 22
I'm trying to insert images into database through JDBC and for doing that I'm reading the image file as a stream of bytes and storing it in a byte array. I'm writing this byte array to the database. When I use BLOB, I'm not able to insert an image whose size is greater than 2kB. An error is being thrown that image size is too large.

How can I insert images of sizes around 300 kB? Please help me out in this regard.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

I've replied more specifically in the other thread you've created. Anyway, let's keep the discussion just in one thread to avoid confusion.

Please post your code and the exception you're getting. As explained in TellTheDetails, no one can help you if you don't.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
Martin Vajsar wrote:I've replied more specifically in the other thread you've created. Anyway, let's keep the discussion just in one thread to avoid confusion. . . .
Quite right. I am sure Jeanne and Scott won't mind if I close this thread.
 
GeeCON Prague 2014
 
subject: Image insertion into database through JDBC