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 2BF7C529A5 for ; Fri, 1 Jul 2005 07:26:08 -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 58066-04 for ; Fri, 1 Jul 2005 10:26:02 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.207]) by svr1.postgresql.org (Postfix) with ESMTP id 0CED3528BD for ; Fri, 1 Jul 2005 07:26:00 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id g2so66855nfe for ; Fri, 01 Jul 2005 03:26:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OCHUL4pvCNmXnbr3wyDwFP7efIC3DpCL1UqyVcspuJVVg51clp7S8fCz534R/Rx8a0XOuFge0vIZ76ys0OVIKnz7vT5Ml6+j0ih1o6TodrjgTUTQXO08pb2y0fuhh4GFWmeMNGMcmuWsrX/gTBXPG2W2vRgxBBScxityPxZJAXU= Received: by 10.48.244.19 with SMTP id r19mr45347nfh; Fri, 01 Jul 2005 03:26:03 -0700 (PDT) Received: by 10.48.249.2 with HTTP; Fri, 1 Jul 2005 03:26:03 -0700 (PDT) Message-ID: <224f3234050701032612fabe04@mail.gmail.com> Date: Fri, 1 Jul 2005 12:26:03 +0200 From: Thomas Dudziak Reply-To: Thomas Dudziak To: pgsql-jdbc@postgresql.org Subject: Re: Create Database using JDBC In-Reply-To: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200507/2 X-Sequence-Number: 13150 On 7/1/05, 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 te= st" > command but I get the following error :=20 >=20 > ERROR: CREATE DATABASE: source database "template1" > is being accessed by other users >=20 > How do I resolve this? I'm using PostGreSQL8.0=20 This should work (we're doing it exactly the same way). But there can only be one user connected at a time to the template database, it seems, at least when using the CREATE DATABASE command. Do you have the one of the PostgreSQL tools open, eg. pgAdmin ? Tom