X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D73FA52915 for ; Fri, 1 Jul 2005 07:30:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59851-07 for ; Fri, 1 Jul 2005 10:30:41 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id E4A2B528BD for ; Fri, 1 Jul 2005 07:30:40 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DoIml-0004YA-Is; Fri, 01 Jul 2005 22:30:15 +1200 Message-ID: <42C51B37.4010603@opencloud.com> Date: Fri, 01 Jul 2005 22:30:15 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nidhi Srivastava Cc: pgsql-jdbc@postgresql.org Subject: Re: Create Database using JDBC References: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com> In-Reply-To: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/3 X-Sequence-Number: 13151 Nidhi Srivastava wrote: > I wish to create a database if one doesn’t exist using JDBC. I tried > connecting to template1 database and then issuing the “CREATE DATABASE > test” command but I get the following error : > > ERROR: CREATE DATABASE: source database "template1" > is being accessed by other users This is no different for JDBC versus createdb. You can't use a database as a source for CREATE DATABASE if it has more than one active connection. I suspect you will find that 'createdb' fails with the same error.. -O