Re: [OT] Tools for inserting blobs? (Oracle)

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Aug 31 2005 - 14:07:52 EDT

  • Next message: Jeff de Vries: "Trying to set qualifier on a saved query?"

    Not sure if the newer versions of Oracle can handle it in a JDBC-
    compliant way, but the way we do it in Cayenne (also described here
    by Cris - http://www.objectstyle.org/cayenne/lists/cayenne-user/
    2004/11/0071.html) is via using "EMPTY_BLOB()" proprietary Oracle
    function. Here is how you'd approach it using JDBC:

    // run this via PreparedStatement to insert a row with empty BLOB
    INSERT INTO BLOB_TEST (BLOB_COL, BLOB_TEST_ID) VALUES (EMPTY_BLOB(), ?)

    // select this row, get java.sql.Blob from ResultSet and write its
    contents using java.sql.Blob API:
    SELECT t0.BLOB_COL, t0.BLOB_TEST_ID FROM BLOB_TEST t0 WHERE
    BLOB_TEST_ID = ?

    Andrus

    On Aug 31, 2005, at 1:03 PM, Mike Kienenberger wrote:

    > This is off-topic, but I'd rather not write cayenne code to solve
    > it :)
    >
    > Are there any tools out there for inserting blob data? In specific,
    > inserting it into Oracle?
    >
    > I need to generate some testing data, and I'd rather not write code
    > to do it :)
    >
    > -Mike
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Aug 31 2005 - 14:07:55 EDT