Re: BLOBS

From: "David Wall" <d(dot)wall(at)computer(dot)org>
To: "PostgreSQL JDBC Mailing List" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: BLOBS
Date: 2004-04-26 15:54:29
Message-ID: 01bb01c42ba7$150a0ed0$3201a8c0@rasta
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> I'm a newbie to PostgreSQL and I'd like to hear some "insight" info about
the "bytea" data type (preferably from people that have actually used them).
> From what I've read so far (online docs), it doesn't seem
> to be that similar to the BLOB data type specified by SQL standard (for
instance, Oracle's BLOB).

I've used regular PG blobs and they don't use bytea, but use the LO
interface underneath and using datatypes of OID in the db. The only issue
for us is that we have to schedule a daily job that runs 'vacuumlo' and our
backup scripts need the options to also backup the LOs. It's worked fine.

> (2) Has somebody worked both with PostgreSQL and Oracle (independently)?
Are there many
> differences between BLOBs through JDBC on either DBMS?

We use both in our code. To use the JDBC blob interfaces, we found we
needed to create a special class that implements the java.sql.Blob interface
and handles the data going in and out of the db. I don't know why JDBC
didn't create some nice Blob wrappers for more traditional stuff, like one
that works with a file descriptor, another with a byte array, etc.

The only difference I recall between the two implementations was on
inserting a new blob. In Oracle, we had to actually insert an empty_blob()
and then follow that up with an SQL UPDATE to set the blob data. I'm not
sure why they need two SQL calls to insert a blob, but that's how it appears
to "work" in Oracle. In PG, you can do the INSERT as expected by specifying
a '?' param in the prepared statement and then using the setBlob() call
passing in your object that implements the Blob interface.

David

In response to

  • BLOBS at 2004-04-26 10:49:43 from Freddy Villalba Arias

Responses

  • Re: BLOBS at 2004-04-26 21:36:34 from Jan de Visser

Browse pgsql-jdbc by date

  From Date Subject
Next Message Edoardo Ceccarelli 2004-04-26 16:38:00 is a good practice to create an index on the oid?
Previous Message Bruce Momjian 2004-04-26 15:44:34 Re: default_with_oid