This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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
Joined: Jul 13, 2009
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.