Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 687B99FA9BD for ; Sat, 21 Jul 2007 18:23:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 16133-04 for ; Sat, 21 Jul 2007 18:22:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx10.roch.ny.frontiernet.net (mx10.roch.ny.frontiernet.net [66.133.183.227]) by postgresql.org (Postfix) with ESMTP id 0E59C9FA6AF for ; Sat, 21 Jul 2007 18:22:27 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAJsVokZChbak/2dsb2JhbACQdw Received: from relay01.roch.ny.frontiernet.net ([66.133.182.164]) by mx10.roch.ny.frontiernet.net with ESMTP; 21 Jul 2007 21:22:26 +0000 Received: from localhost (filter03.roch.ny.frontiernet.net [66.133.183.70]) by relay01.roch.ny.frontiernet.net (Postfix) with ESMTP id CBD7EB5195; Sat, 21 Jul 2007 21:22:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new-2.4.2 at filter03.roch.ny.frontiernet.net Received: from relay01.roch.ny.frontiernet.net ([66.133.182.164]) by localhost (filter03.roch.ny.frontiernet.net [66.133.183.70]) (amavisd-new, port 10024) with LMTP id SlKpoPzkoUll; Sat, 21 Jul 2007 21:22:25 +0000 (UTC) X-Trace: 53616c7465645f5f2dd387404262fea387991c93d52bc574cb2fd120405b41e34112aefe13a3d0c3616d1c8a63848d6d4b6f32b0e52bc7a0cc44da7152450ecc31bcc9eed4eb4b69595a23a25272a2d1ad2b0d5e8b8ff07ea1fef59c5c005ce8 Received: from wingfoot.jancm.org (74-36-20-163.dsl1.mon.ny.frontiernet.net [74.36.20.163]) by relay01.roch.ny.frontiernet.net (Postfix) with ESMTP id CBBC0B5260; Sat, 21 Jul 2007 20:55:13 +0000 (UTC) Received: from Spooler by wingfoot.jancm.org (Mercury/32 v4.51) ID MO000DA1; 21 Jul 2007 16:55:13 -0400 Received: from spooler by jancm.org (Mercury/32 v4.51); 21 Jul 2007 16:55:09 -0400 X-CLAMWALL: Passed through antiviral test by ClamWall 1.1.4 on jancm.org (1464) Received: from local.jancm.org (10.54.11.10) by SMTP.JANCM.ORG (Mercury/32 v4.51) with ESMTP ID MG000DA0 (Using SSL/TLS, 3DES, CBC mode, keysize 192 bits) ; 21 Jul 2007 16:55:07 -0400 From: "Jan Muszynski" Organization: Chaotic at Best To: "Michael Peters" , pgsql-odbc@postgresql.org Date: Sat, 21 Jul 2007 16:55:06 -0400 MIME-Version: 1.0 Subject: Re: Switching Between Databases Message-ID: <46A23A6A.23441.1C9A9DD@postgres.jancm.org> In-reply-to: References: X-mailer: Pegasus Mail for Windows (4.41) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/47 X-Sequence-Number: 9102 On 21 Jul 2007 at 16:25, Michael Peters wrote: > I was not entirely sure how to frame my search of ODBC mailing database on > this topic so my apologies if it has been previously discussed at length. > > When using the MySQL ODBC driver it is possible to frame an SQL query to > select a chosen database on the fly.within a single DSN Connection Instance > > For example > > Select * from weather.cities > > Would select everything from the Cities Table within the Weather DB. > > Alternatively > > Use Weather > Select * from cities > > Would do the same thing but require two SQL statements similar to psql which > would be > > \c weather > Select * from cities > > Question > > Is it possible when using the PostgreSQL ODBC driver to switch back and > forth between different Databases within a single connection instance? > > Mike You can switch between schemas, but not between DB's. Which means that you can accomplish the same thing, just approaching it differently. Instead of multiple DB's just set up multiple schema's. Then the way to chenage becomes: Select item from schema1.table; or SET search_path TO schema1; Select item from table; That will select from schema1.table You can also say something like: SET search_path TO schema1,schema2,public; and in that case any object will be chosen from the first schema (in the defined sequence) in which it's found (with public being the default schema). Read up on schemas in the documentation for more info. But, at least at the current time, a construct like dbname.schema.table isn't supported (which is what would be needed for multiple DB support). HTH