Create a new database from JDBC?

From: Dan Armbrust <daniel(dot)armbrust(dot)list(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Create a new database from JDBC?
Date: 2006-02-08 17:03:45
Message-ID: 43EA2471.1070306@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How do I make a connection to a Postgresql database that (potentially)
has 0 databases from jdbc, so that I can issue a create database command?

In that _other_ database, I can make a jdbc connection to an address
like this:

jdbc:mysql://servername/

And then issue a "Create database foo" command.

Then I can reconnect to
jdbc:mysql://servername/foo

And everything is good.

If I try to connect to a postgresql database like this:

jdbc:postgresql://servername/

Postgres attempts to connect to a database that is named the same as the
username I provided.

Certainly not what I want, since that database doesn't exist. Is there
a system database I could always count on being available that I could
connect to?

Thanks,

Dan

--
****************************
Daniel Armbrust
Biomedical Informatics
Mayo Clinic Rochester
daniel.armbrust(at)mayo.edu
http://informatics.mayo.edu/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-02-08 17:26:04 Re: Create a new database from JDBC?
Previous Message Dick Kniep 2006-02-08 17:02:08 Re: B-tree performance improvements in 8.x