pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Edoardo Ceccarelli <eddy@axa.it>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: blob without largeobject api
Date: Wed, 07 Apr 2004 00:24:35 +1200
Message-ID: <4072A183.6030802@opencloud.com> (raw)
In-Reply-To: <40729A9A.3060001@axa.it>
References: <40712C3B.4070606@expot.it>
	<4071D255.3000504@opencloud.com>
	<40729A9A.3060001@axa.it>

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



view thread (9+ messages)  latest in thread

Message-ID: <4072A183.6030802@opencloud.com>
Permalink:  ../4072A183.6030802@opencloud.com/
Also on:    postgresql.org/message-id/4072A183.6030802@opencloud.com

 · 

reply

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: oliver@opencloud.com, eddy@axa.it
  Subject: Re: blob without largeobject api
  In-Reply-To: <4072A183.6030802@opencloud.com>
  References: <40712C3B.4070606@expot.it> <4071D255.3000504@opencloud.com> <40729A9A.3060001@axa.it> <4072A183.6030802@opencloud.com>

* 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