[OT] Tools for inserting blobs? (Oracle)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[OT] Tools for inserting blobs? (Oracle)

Mike Kienenberger
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
Reply | Threaded
Open this post in threaded view
|

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

Andrus Adamchik
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
>
>

Reply | Threaded
Open this post in threaded view
|

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

Mike Kienenberger
Yeah, I decided to just create a Cayenne standalone app to do it for me.
Turned out to be easier than I remembered :)  Seems to be working.

-Mike

On 8/31/05, Andrus Adamchik <[hidden email]> wrote:

> 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
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

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

Joshua Pyle
yea Cayenne handles the blobs into ORacle just fine.  Sold me on it!

--
Joshua T. Pyle
Go has always existed.


On 8/31/05, Mike Kienenberger <[hidden email]> wrote:

> Yeah, I decided to just create a Cayenne standalone app to do it for me.
> Turned out to be easier than I remembered :)  Seems to be working.
>
> -Mike
>
> On 8/31/05, Andrus Adamchik <[hidden email]> wrote:
> > 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
> > >
> > >
> >
> >
>