Re: Create Database using JDBC

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Nidhi Srivastava <nsrivastava(at)quark(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Create Database using JDBC
Date: 2005-07-01 10:30:15
Message-ID: 42C51B37.4010603@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nidhi Srivastava 2005-07-01 10:33:55 Re: Create Database using JDBC
Previous Message Thomas Dudziak 2005-07-01 10:26:03 Re: Create Database using JDBC