pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Nidhi Srivastava <nsrivastava@quark.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Create Database using JDBC
Date: Fri, 01 Jul 2005 22:30:15 +1200
Message-ID: <42C51B37.4010603@opencloud.com> (raw)
In-Reply-To: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com>
References: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com>

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



view thread (20+ messages)  latest in thread

Message-ID: <42C51B37.4010603@opencloud.com>
Permalink:  ../42C51B37.4010603@opencloud.com/
Also on:    postgresql.org/message-id/42C51B37.4010603@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, nsrivastava@quark.com
  Subject: Re: Create Database using JDBC
  In-Reply-To: <42C51B37.4010603@opencloud.com>
  References: <2BC68159E3EC814BA1E81C108DF99A4203A37FD9@EXCH-IND-VS1.india.quark.com> <42C51B37.4010603@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox