Unix Technical Forum

Switching database inside current connection

This is a discussion on Switching database inside current connection within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> I have to search multiple, identical databases on a server and am currently having to create a DataSource for ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 12:19 AM
Jeff Madison
 
Posts: n/a
Default Switching database inside current connection

I have to search multiple, identical databases on a server and am
currently having to create a DataSource for each database on the server
and then get a connection. How would I create a DataSource for the
server and then modify the connnection to "switch" databases. I would
like to just re-use the same connection for obvious reasons.

I'm running server version 7.3 and the coinciding JDBC driver version.

Jeff


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 12:19 AM
Kris Jurka
 
Posts: n/a
Default Re: Switching database inside current connection



On Wed, 27 Sep 2006, Jeff Madison wrote:

> I have to search multiple, identical databases on a server and am currently
> having to create a DataSource for each database on the server and then get a
> connection. How would I create a DataSource for the server and then modify
> the connnection to "switch" databases. I would like to just re-use the same
> connection for obvious reasons.


This is not possible with postgresql. You can only use the database you
initially connected to. To access parts of other database you can use
contrib/dblink, but for your purposes I think multiple connections are
required.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 12:19 AM
Scott Marlowe
 
Posts: n/a
Default Re: Switching database inside current connection

On Wed, 2006-09-27 at 23:17, Jeff Madison wrote:
> I have to search multiple, identical databases on a server and am
> currently having to create a DataSource for each database on the server
> and then get a connection. How would I create a DataSource for the
> server and then modify the connnection to "switch" databases. I would
> like to just re-use the same connection for obvious reasons.
>
> I'm running server version 7.3 and the coinciding JDBC driver version.


If you can move away from individual databases to multiple schemas in
one database, then your problem would be solved. Schema support was
initially added in 7.3, but the tools needed for examining schemas and
such were not quite done all the way back then. Upgrading to 7.4 at
least makes dealing with schemas a little easier, and if you're
upgrading to 7.4, might as well go all the way and get 8.1.4. 7.3 is on
the very tail end of what's considered "supported".

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:35 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com