EJB design: Update blob in oracle of size > 2k using jdbc
- Posted by: Ajit Kar
- Posted on: November 18 2004 00:57 EST
I am having a problem in updating a blob column in oracle from jdbc if the size of the blob is greater than 2K in size. The space allocated for the blob column in 2G.
Could anyone help in this regard
- Update blob in oracle of size > 2k using jdbc by Tracy Hartley on November 18 2004 04:57 EST
- Update blob in oracle of size > 2k using jdbc by Dana Carroll on November 18 2004 17:14 EST
- i like the oracle stored procs for this by bruce goldstein on November 23 2004 11:40 EST
- Update blob in oracle of size > 2k using jdbc by Hanson Char on July 07 2005 03:20 EDT
Ajit, I believe this is a known issue with the thin jdbc driver - at least it was for Oracle 8, don't know if it's been fixed in 9+. The oci drivers don't have this problem.
Hi,I am having a problem in updating a blob column in oracle from jdbc if the size of the blob is greater than 2K in size. The space allocated for the blob column in 2G.Could anyone help in this regardThanksAjit
How are you doing your update? I have done this successfully in the past, but you can't just do a "update blah set field = value" query. You need to do a select for update on the column, get the stream, then write to that stream. You can then write any size Java string to the field.
I personally like the oracle stored proces for this. Specifically dbms_lob.write (and truncate). You still need a blob but the advantage is that you do not have to use oracles derived implementations of the blob and result set, etc.
Also, a 2k limit sounds like you are writing the data as a string (varchar 4k limit?). Not as a blob.
One solution to get around this problem is to use the Oracle 10.1.0.4 JDBC thin driver, instead of the Oracle 9.2.0.x thin driver, to work against the Oracle 9.2.0.x database. Apparently it's related a bug in the 9.2.0.x JDBC driver.
I also got this problem.
After searching the web for reasons, it turned out that it is a known bug in the driver.
(source code of org.apache.ojb.broker.platforms.PlatformOracleImpl).
We are still using Oracle 8.1.7.
Did anybody work arround this bug?
I will next try to use SELECT FOR UPDATE instead.
Could i possibly also use a newer driver?
Thanks for any help,
Hi, I'm having the same proble. I added new JDBC driver jar for Oracle 10.2 version. But Still having the same problem. May be data is currupted before inserting into the database :o( Can any1 help?