Re: Switching user within connection.

From: Rob Kirkbride <rob(at)rkcomputing(dot)co(dot)uk>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Switching user within connection.
Date: 2005-11-23 11:09:00
Message-ID: 43844DCC.3040705@rkcomputing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett wrote:

> Rob Kirkbride wrote:
>
>> Is there a standard way (or indeed a special way in Postgres) to
>> switch user/password without creating a new connection?
>> You can obviously do it within psql with \c but I wondered whether
>> there was a way in JDBC?
>
>
> There is no standard JDBC way I know of, short of reconnecting.
>
> AFAIK there's no way at the protocol level to reauthenticate as a
> different user on an existing connection. I believe psql's \c command
> actually establishes a new connection.
>
> If you originally connected as the database superuser you could use
> SET SESSION AUTHORIZATION to get a similar effect; see
> http://www.postgresql.org/docs/8.1/static/sql-set-session-authorization.html.
>
>
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.

Rob

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rob Kirkbride 2005-11-23 11:10:28 Re: Switching user within connection.
Previous Message Tjioe Ai Xin 2005-11-23 11:02:32 Re: Can PostgreSQL do data type automated casting in