Skip site navigation (1) Skip section navigation (2)

Creating a database using ant

From: Nathan McEachen <nathan(at)mceachen(dot)us>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Creating a database using ant
Date: 2005-11-21 04:24:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

I am trying to write get ant to drop and create a database.  I tried to 
use the sql task but recieved the following error:

java.sql.SQLException: ERROR: DROP DATABASE cannot run inside a 
transaction block

Here is my ant task:

        <sql driver="${db.postgresql.driver}"
                <path refid="run.classpath"/>  

Although autocommit is false, it looks like the sql script is still 
executing within a transaction.  Does anyone know a workaround?

I also tried runing the dropdb command directly, but (from my 
understanding) ant cannot receive user input during execution.  As a 
result, I can't supply a password to dropdb (at least I don't know how 
to do it).

        <exec executable="${postgres_bin.dir}/dropdb"
          <arg value="-U"/>
          <arg value="${rootuser}"/>
          <arg value="--password"/>
          <arg value="mydb"/>

Many thanks,


In theory, there is no difference between theory and practice.  But, in practice, there is.

--Jan L.A. van de Snepscheut


pgsql-jdbc by date

Next:From: Tjioe Ai XinDate: 2005-11-21 04:39:15
Subject: Re: Problem when upgrade PostgreSQL 7.3.3 to PostgreSQL 8.0.3
Previous:From: Oliver JowettDate: 2005-11-21 00:24:37
Subject: Re: PreparedStatement.getParameterMetaData

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group