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 32810D1E9D2 for ; Tue, 6 Apr 2004 09:24:08 -0300 (ADT) 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 05147-04 for ; Tue, 6 Apr 2004 09:24:49 -0300 (ADT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 38139D1E90B for ; Tue, 6 Apr 2004 09:24:01 -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 1BApd9-00047j-00; Wed, 07 Apr 2004 00:24:39 +1200 Message-ID: <4072A183.6030802@opencloud.com> Date: Wed, 07 Apr 2004 00:24:35 +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: Edoardo Ceccarelli Cc: pgsql-jdbc@postgresql.org Subject: Re: blob without largeobject api References: <40712C3B.4070606@expot.it> <4071D255.3000504@opencloud.com> <40729A9A.3060001@axa.it> In-Reply-To: <40729A9A.3060001@axa.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/53 X-Sequence-Number: 9782 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