Re: switching db's on the fly

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Toby Doig <toby(at)paperjet(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: switching db's on the fly
Date: 2002-07-03 16:23:17
Message-ID: 200207031623.g63GNHg13820@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Toby Doig wrote:
> after connecting to a db under pg 7.2.x using the url, is it possible to
> switch to another db hosted on the same machine without reconnecting?
>
> i have a setup with several databases all hosted on the same server with
> the same db owner etc. i've written my own pooling but then i need to pool
> for each db which, given the number of db's, means i end up with a lot of
> idle connections using resources.
>
> what would be better is to be able to switch to the appropriate db
> when the connection is retrieved from the pool. this then pools
> connections between db's as well. i understand there's some mgmt involved
> with access to the db on a switch, but i believe this is easily managed.
>
> under mssql server you can use the USE <database> command.
> Is there some equivalent or some hack possible?

No, sorry, you have to reconnect. psql has a \connect, but it just
reconnects too.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Th Templ 2002-07-04 07:17:21 Re: Problem with sql function LOWER
Previous Message Tom Lane 2002-07-03 15:56:46 Re: Problem with sql function LOWER