pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Roland Walter <roland.walter.rwa@gmx.net>
Cc: Charlie Kelly <Charlie@CharlieKelly.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Use Driver to Create database?
Date: Sun, 19 Nov 2006 22:04:10 +0000
Message-ID: <4560D4DA.7090708@enterprisedb.com> (raw)
In-Reply-To: <4560CFAF.7020105@gmx.net>
References: <1163715629.8932.22.camel@mokki.local>
	<4560B46C.50109@CharlieKelly.com>
	<4560CFAF.7020105@gmx.net>

Roland Walter wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Charlie Kelly wrote:
>> Is it possible to use the driver to create a new database (inside a java
>> program),
>> or is it necessary to first create the database using the createdb utility?
>>
>> If it is possible to use the driver, what is the correct syntax?
>>
> 
> There is a SQL-command for that, look here:
> 
> 
> http://www.postgresql.org/docs/8.1/interactive/sql-createdatabase.html
> 
> First connect to the postgres or template1 schema of the cluster, that
> you created with initdb. Execute the "CREATE DATABASE". Reconnect to the
> database you created.

You don't want to connect to template1, though, if the program is going 
to be used concurrently by more than one use. Template1 is used as 
template (hence the name) to make the new database, and it will throw an 
error if there's any other users connected to it beside the one issuing 
the CREATE DATABASE command.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (6+ messages)  latest in thread

Message-ID: <4560D4DA.7090708@enterprisedb.com>
Permalink:  ../4560D4DA.7090708@enterprisedb.com/
Also on:    postgresql.org/message-id/4560D4DA.7090708@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: heikki@enterprisedb.com, roland.walter.rwa@gmx.net, Charlie@CharlieKelly.com
  Subject: Re: Use Driver to Create database?
  In-Reply-To: <4560D4DA.7090708@enterprisedb.com>
  References: <1163715629.8932.22.camel@mokki.local> <4560B46C.50109@CharlieKelly.com> <4560CFAF.7020105@gmx.net> <4560D4DA.7090708@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox