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 8383ED1BB74 for ; Tue, 6 Apr 2004 09:36:29 -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 05697-10 for ; Tue, 6 Apr 2004 09:37:15 -0300 (ADT) Received: from FE-mail03.sfg.albacom.net (FE-mail03.albacom.net [213.217.149.83]) by svr1.postgresql.org (Postfix) with ESMTP id 6E92AD1B98D for ; Tue, 6 Apr 2004 09:36:27 -0300 (ADT) Received: from axa.it (217.221.81.76) by FE-mail03.sfg.albacom.net (7.0.009) id 406E6B210004FEDE; Tue, 6 Apr 2004 14:36:39 +0200 Message-ID: <4072A458.3020808@axa.it> Date: Tue, 06 Apr 2004 14:36:40 +0200 From: Edoardo Ceccarelli User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: it, en, en-us MIME-Version: 1.0 To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: blob without largeobject api References: <40712C3B.4070606@expot.it> <4071D255.3000504@opencloud.com> <40729A9A.3060001@axa.it> <4072A183.6030802@opencloud.com> In-Reply-To: <4072A183.6030802@opencloud.com> 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/45 X-Sequence-Number: 9774 I was thinking to get this chance and drop the Resin pool to start using Postgres one for all database connections in my app. Can you give me some hints about its reliability and point me some example code? Thanks again Edoardo PS: the procedure to clean up not referenced LO's would be needed also using LargeObjectAPI? Oliver Jowett ha scritto: > 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 > > >