Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id A9D839FA16B for ; Sun, 19 Nov 2006 18:04:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 31559-10 for ; Sun, 19 Nov 2006 18:04:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 169639F9F47 for ; Sun, 19 Nov 2006 18:04:17 -0400 (AST) thread-index: AccMJqmGmKTgNRVqQJyWMmEfdAMbzQ== Received: from [192.168.1.10] ([82.2.52.61]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Sun, 19 Nov 2006 17:04:18 -0500 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757 Content-class: urn:content-classes:message Importance: normal Message-ID: <4560D4DA.7090708@enterprisedb.com> Date: Sun, 19 Nov 2006 22:04:10 +0000 From: "Heikki Linnakangas" User-Agent: Thunderbird 1.5.0.7 (X11/20060927) MIME-Version: 1.0 To: "Roland Walter" Cc: "Charlie Kelly" , Subject: Re: Use Driver to Create database? References: <1163715629.8932.22.camel@mokki.local> <4560B46C.50109@CharlieKelly.com> <4560CFAF.7020105@gmx.net> In-Reply-To: <4560CFAF.7020105@gmx.net> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Nov 2006 22:04:19.0156 (UTC) FILETIME=[A945C140:01C70C26] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/94 X-Sequence-Number: 16136 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