From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Edoardo Ceccarelli <eddy(at)axa(dot)it> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: blob without largeobject api |
Date: | 2004-04-06 12:24:35 |
Message-ID: | 4072A183.6030802@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Edoardo Ceccarelli wrote:
> 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();
Ok, this means your pooling implementation is not using the postgresql
driver's PooledConnection to generate the proxy connections to hand out,
but is implementing them itself (using instances of
com.caucho.sql.UserConnection, it appears). So you won't be able to get
at postgresql-specific interfaces with that pooling implementation,
regardless of what the driver does.
> 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.
That's the basic idea, although there's no real need to separate the
insert and update. With compatible=7.1 in effect, setBytes() becomes
"create an appropriate LO and set the parameter to the new OID". The
main gotcha is that you must wrap any queries that deal with LOs in a
transaction; autocommit won't work. You'll also need a mechanism to
clean up LOs that no longer have references to them in the main DB (I
think there might be something in contrib/ to do this?)
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Edoardo Ceccarelli | 2004-04-06 12:36:40 | Re: blob without largeobject api |
Previous Message | Edoardo Ceccarelli | 2004-04-06 11:55:06 | Re: blob without largeobject api |