• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.sqlexception data size bigger than max size for this type

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers.

I'm developing an application using Apache Turbine + Torque and Oracle 10g for my DB and am encountering this error:

java.sql.sqlexception data size bigger than max size for this type.

I've searched it in Google and everyone says that you should use a BLOB type instead of a LONG RAW, but my problem is that I'm using BLOB to store a 17k image in the database. My code is as follows:



I have trimmed the rest of it as it is non-relevant, but the basics are there. I'm using a Torque object (entryIntratImagenes) to save into the database, and am getting the image bytes through a regular SQL Query.

My table is as follows:



What could be wrong? Why is it telling me the max size for BLOB is not big enough to save 17k bytes?

Thanks a lot!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that is the code that is causing your error? LOBs don't have a maximum size, and data truncation error only usually occur on update or insert not select.
 
A Shehadi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have found the error.

It lies within the Oracle JDBC driver. Apparently there's a bug in the version I was using that sets LOB file types to a maximum size of 4K, which renders them almost useless.

I just downloaded a new driver version (10.2.0.4 I believe) and it all worked flawlessly. At least in my local machine....because as soon as I deploy it on our webserver (Oracle App Server) it breaks again


 
A Shehadi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it turns out that for some reason my App Server is not using the updated ojdbc14 library, so the error persists.

If anyone is still interested, the workaround was to insert every other piece of data besides the Blob (insert null in the blob) and the either update the blob field using an OutputStream or directly from another table in the same database and it will work fine.

I hope this helps.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic