Обсуждение: creating database fails on windows XP: Postgres 8.0
Hi,
I am getting following error while trying to create a new database called mydb on my newly installed postgres 8.0 version on XP.
Following is the code from build.xml that is being executed by ant. The "classpathref="my.classpath"> line gives the
"BUILD FAILED D:\project\build.xml:48: org.postgresql.util.PSQLException: ERROR: CREATE DATABASE cannot run inside a transaction block" error.
Code from build.xml:
<target name="db.create.postgres.mydb">
<sql driver="${database.driver.postgres}"
url="${base-database.url.postgres}"
userid="${database.rootuser.postgres}"
password="${database.rootpassword.postgres}"
src="${db-script.postgres}"
classpathref="my.classpath">
</sql>
</target>
<sql driver="${database.driver.postgres}"
url="${base-database.url.postgres}"
userid="${database.rootuser.postgres}"
password="${database.rootpassword.postgres}"
src="${db-script.postgres}"
classpathref="my.classpath">
</sql>
</target>
The db-scripts.posgres points to a file containing following text.
CREATE USER myuser PASSWORD 'mypasswd';
CREATE DATABASE mydb TEMPLATE template0 OWNER myuser;
GRANT ALL PRIVILEGES ON DATABASE mydb to myuser;
CREATE DATABASE mydb TEMPLATE template0 OWNER myuser;
GRANT ALL PRIVILEGES ON DATABASE mydb to myuser;
Appreciate any help.
Regards,
Neeraj Jain.