From: Edoardo Ceccarelli <eddy@axa.it>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: blob without largeobject api
Date: Tue, 06 Apr 2004 13:55:06 +0200
Message-ID: <40729A9A.3060001@axa.it> (raw)
In-Reply-To: <4071D255.3000504@opencloud.com>
References: <40712C3B.4070606@expot.it>
<4071D255.3000504@opencloud.com>
Tried with a driver downloaded from http://jdbc.postgresql.org/
pg74.213.jdbc3.jar
the result is always the same:
java.lang.ClassCastException: com.caucho.sql.UserConnection
on row:
LargeObjectManager lom =
((org.postgresql.PGConnection)db).getLargeObjectAPI();
I think that the second suggestion is about using a "standard" way to
save a blob field, I have tried something like this:
- insert record without blob
- open record for update and use setBytes() to save blob data
having some minor problems so far but I'd like to know if this is the
right way to do it.
thanks again
Edoardo
Oliver Jowett ha scritto:
> Edoardo Ceccarelli wrote:
>
>> I need to insert a Blob into a table without using
>> org.postgresql.largeobject.*; classes, that's because the db pool I'm
>> using (Resin) doesn't allow me to cast:
>> ((org.postgresql.PGConnection)db) to get access at the Postgres
>> LargeObjectAPI.
>>
>> // Generates ClassCastExep.
>> LargeObjectManager lom =
>> ((org.postgresql.PGConnection)db).getLargeObjectAPI();
>>
>> Since I'd like to keep using the same type of connection (without
>> changing the pool manager or directly connecting to the db) is there
>> a way to insert Blob (oid) data into a table without using the large
>> object api?
>
>
> 1) Check you are using a recent driver; pre-7.4 drivers had a bug
> where proxy connections handed out by the driver's PooledConnection
> implementation (which is probably what Resin is using) did not
> implement PGConnection, which may be the cause of your CCE.
>
> 2) Add '?compatible=7.1' (or '&compatible=7.1' if you already have URL
> parameters present) to your driver URL and use
> PreparedStatement.setBytes() / ResultSet.getBytes(). Note that you
> won't be able to use these methods to access bytea fields if you do
> this, and might change other behaviour of the driver too.
>
> -O
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: eddy@axa.it, oliver@opencloud.com
Subject: Re: blob without largeobject api
In-Reply-To: <40729A9A.3060001@axa.it>
References: <40712C3B.4070606@expot.it> <4071D255.3000504@opencloud.com> <40729A9A.3060001@axa.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox