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 DBB08D1BB93 for ; Tue, 6 Apr 2004 20:33:17 -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 11340-03 for ; Tue, 6 Apr 2004 20:33:19 -0300 (ADT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id DB0B1D1BB74 for ; Tue, 6 Apr 2004 20:33:15 -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 1BB046-0004o4-00; Wed, 07 Apr 2004 11:33:10 +1200 Message-ID: <40733E34.9020209@opencloud.com> Date: Wed, 07 Apr 2004 11:33:08 +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> <4072A183.6030802@opencloud.com> <4072A458.3020808@axa.it> In-Reply-To: <4072A458.3020808@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/59 X-Sequence-Number: 9788 Edoardo Ceccarelli wrote: > 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? I don't use a 3rd party connection pool for various reasons so I can't really recommend one. I think the driver does provide a pool implementation, but it didn't seem too flexible at a glance -- and it's going to blindside any app server you're using since it just looks like a DataSource.. What you really want is a pooling implementation that uses the implementations of ConnectionPoolDataSource provided by the driver: org.postgresql.jdbc2.optional.ConnectionPool or org.postgresql.jdbc3.ConnectionPool. Despite the name, these classes provide *support* for connection pool implementations but no actual pooling implementation or policy. What they do is provide a means for the actual pooling implementation to get PooledConnection objects representing physical connections to the DB; these are the objects that get pooled and reused. Each PooledConnection allows you to get proxy connection handles that look like normal JDBC connections, except that they actually delegate back to the underlying physical connection. Closing a proxy connection invokes a listener callback rather than closing the physical connection; the pool implementation can use this callback to return the physical connection to its pool. Connection pool implementations can then build whatever pooling policy they want on top of this, and hand out these proxy connection handles to their clients. The reason you want to use this sort of approach is that the proxy connections handed out by the driver can implement any driver extensions as necessary, without the connection pool itself having to know about it -- i.e. in this case the proxy connections would implement PGConnection. I'm not familiar with Resin, but is it possible that you can just tell it to use the driver's ConnectionPoolDataSource implementation and it'll use this sort of strategy? > PS: the procedure to clean up not referenced LO's would be needed also > using LargeObjectAPI? True, but usually if you're directly using the LO API you will be dealing with OIDs yourself and could do the cleanup yourself via the LO API's unlink() method from your app. If you're just using setBytes() to manage them transparently and don't have access to the LO API, there's no way to delete the underlying old LO when you update a field containing a LO OID.. -O