Discussions

EJB design: Update blob in oracle of size > 2k using jdbc

  1. Update blob in oracle of size > 2k using jdbc (6 messages)

    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 regard

    Thanks

    Ajit
  2. 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.
  3. 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.
  4. 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.

    Regards,

    Bruce
  5. 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.

    Hanson
  6. I also got this problem.
    After searching the web for reasons, it turned out that it is a known bug in the driver.
    See also:
    http://www.koders.com/java/fid9104868B82F5B700A98A7F901815AACB146A7F4F.aspx
    (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,
    Sven
  7. 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?