X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 973F6D6857 for ; Wed, 23 Nov 2005 07:30:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63499-05 for ; Wed, 23 Nov 2005 11:30:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr1.postgresql.org (Postfix) with ESMTP id B9A86DB90C for ; Wed, 23 Nov 2005 07:30:35 -0400 (AST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Eespe-0002SE-Ir; Thu, 24 Nov 2005 00:30:34 +1300 Message-ID: <438452D9.8020402@opencloud.com> Date: Thu, 24 Nov 2005 00:30:33 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rob Kirkbride CC: pgsql-jdbc@postgresql.org Subject: Re: Switching user within connection. References: <43843F94.6070900@rkcomputing.co.uk> <43844B2F.1010309@opencloud.com> <43844DCC.3040705@rkcomputing.co.uk> In-Reply-To: <43844DCC.3040705@rkcomputing.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/166 X-Sequence-Number: 14264 Rob Kirkbride wrote: > Thanks for your reply. I think I'd guessed that would be the reply. It's > probably off topic really now but I wanted to maintain a series of > pooled connections but with potentially different users. I got lost > reading the JCA documentation which may do something clever but I'm > guessing if the underlying JDBC driver doesn't support it then there's > not a lot it can do really. My JCA is a bit rusty, but from memory the way you deal with this is by implementing ManagedConnectionFactory.matchManagedConnections() to only consider connections that have matching authentication info. So the container can maintain a single pool of connections, but when it asks the connector for a suitable connection authenticated as Joe then only connections in the pool that are already authenticated as Joe are considered. You may end up needing more connections in the pool depending on the actual usage pattern, but you don't need to reauthenticate on an existing connection. -O