Re: Create Database using JDBC

From: Thomas Dudziak <tomdzk(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Create Database using JDBC
Date: 2005-07-01 10:26:03
Message-ID: 224f3234050701032612fabe04@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 7/1/05, Nidhi Srivastava <nsrivastava(at)quark(dot)com> 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
>
> How do I resolve this? I'm using PostGreSQL8.0

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-07-01 10:30:15 Re: Create Database using JDBC
Previous Message Nidhi Srivastava 2005-07-01 08:30:53 Create Database using JDBC