Re: Switching user within connection.

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Switching user within connection.
Дата
Msg-id 438452D9.8020402@opencloud.com
обсуждение исходный текст
Ответ на Re: Switching user within connection.  (Rob Kirkbride <rob@rkcomputing.co.uk>)
Ответы Re: Switching user within connection.  (Rob Kirkbride <rob@rkcomputing.co.uk>)
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Rob Kirkbride
Дата:
Сообщение: Re: Switching user within connection.
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Reg : Exception ( Postgresql with Java -JDBC)