X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C1ED6D1C951 for ; Mon, 5 Apr 2004 21:40:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93786-03 for ; Mon, 5 Apr 2004 18:40:44 -0300 (ADT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 17D0AD1B974 for ; Mon, 5 Apr 2004 18:40:11 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1BAbpg-0002r2-00; Tue, 06 Apr 2004 09:40:40 +1200 Message-ID: <4071D255.3000504@opencloud.com> Date: Tue, 06 Apr 2004 09:40:37 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: eddy@expot.it Cc: pgsql-jdbc@postgresql.org Subject: Re: blob without largeobject api References: <40712C3B.4070606@expot.it> In-Reply-To: <40712C3B.4070606@expot.it> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/37 X-Sequence-Number: 9766 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