Show Databases via ODBC

Started by Bret Sternabout 14 years ago3 messagesgeneral
Jump to latest
#1Bret Stern
bret_stern@machinemanagement.com

Is it possible through ODBC to connect to a PostgreSql
server and query for the available databases?

When our application upgrades, we typically create a
new database. I want to design a form which allows
the user to select the old database, which then
migrates data to the new (currently connected)
database.

Regards

#2Szymon Guz
mabewlun@gmail.com
In reply to: Bret Stern (#1)
Re: Show Databases via ODBC

On 7 March 2012 20:36, Bret Stern <bret_stern@machinemanagement.com> wrote:

Is it possible through ODBC to connect to a PostgreSql
server and query for the available databases?

When our application upgrades, we typically create a
new database. I want to design a form which allows
the user to select the old database, which then
migrates data to the new (currently connected)
database.

Regards

Hi,
I think this query would be helpful:

select datname from pg_database;

regards
Szymon

#3Bret Stern
bret_stern@machinemanagement.com
In reply to: Szymon Guz (#2)
Re: Show Databases via ODBC

Works perfect. I'll trap and show only our databases to the user.
all thanks

Show quoted text

On Wed, 2012-03-07 at 21:00 +0100, Szymon Guz wrote:

On 7 March 2012 20:36, Bret Stern <bret_stern@machinemanagement.com>
wrote:
Is it possible through ODBC to connect to a PostgreSql
server and query for the available databases?

When our application upgrades, we typically create a
new database. I want to design a form which allows
the user to select the old database, which then
migrates data to the new (currently connected)
database.

Regards

Hi,
I think this query would be helpful:

select datname from pg_database;

regards
Szymon