Skip site navigation (1) Skip section navigation (2)

Re: blob without largeobject api

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: eddy(at)expot(dot)it
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: blob without largeobject api
Date: 2004-04-05 21:40:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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.


In response to


pgsql-jdbc by date

Next:From: Oliver JowettDate: 2004-04-05 21:48:58
Subject: Re: JTA / JDBC support
Previous:From: Jim EwertDate: 2004-04-05 18:36:44
Subject: Slow updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group