You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Carlos Villegas <ca...@uniscope.jp> on 2005/01/24 14:59:05 UTC
generic BLOB support
Hi,
I'm writing a store based on OJB for the Jakarta Slide WebDAV server and
one of the main reasons for using OJB is to get database independence.
So far it's been ok but now I'm at the point where I need to store the
file contents into the database. Naturally I want to use the BLOB data
type and I want to make sure that the BLOB is not brought into memory
but accessed via io streams. However, it seems that not all databases
have a true BLOB type or good JDBC support for it but they all seem to
have some support for large objects.
So, what would be the best way to do this?
I haven't actually tested anything but just looking at PostgreSQL, for
instance, it doesn't seem that JDBC type BLOB mapped to native bytea
type would work, or BLOB to oid (pg large object interface). Note that I
want to have a fixed java data type across all databases.
Any suggestions?
Carlos
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: generic BLOB support
Posted by Thomas Dudziak <to...@gmail.com>.
BLOB is a JDBC datatype that is mapped by the concrete JDBC driver
(which is database specific) to the real database SQL type. In the
case of PostgreSQL, the jdbc driver maps it to bytea. You can see the
difference in the related OJB files: in repository.xml you use BLOB as
the datatype, and in the database schema (Torque files or SQL calls),
you use the corresponding database type, e.g. bytea for PostgreSQL.
So, IMO your best bet is using BLOB, e.g. via java.sql.Blob objects.
I'm not sure whether BLOB support is required for some JDBC level
(perhaps 2.0 ?), but every JDBC-supported database that has a large
binary datatype should have a BLOB-supporting JDBC driver.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org