DDL in transactions? - Mailing list pgsql-jdbc

From Giuseppe Sacco
Subject DDL in transactions?
Date
Msg-id 1112254334.3881.8.camel@localhost
Whole thread Raw
Responses Re: DDL in transactions?
List pgsql-jdbc
Hi,
I have a question about 7.4 jdbc driver. I am executing this code:

--------------------
conn=datasource.getPooledConnection().getConnection();
conn.setAutoCommit(false);
stmt=conn.createStatement();

stmt.executeUpdate("CREATE TABLE X (X VARCHAR(100))");
//stmt.commit(); // <= Look at this line
stmt.executeUpdate("INSERT INTO X VALUES ('string')");
stmt.commit();

stmt.close();
conn.close();
--------------------

And I found that, using postgresql jdbc driver, I need to add the
commit() call that is commented out, otherwise I get an error like
'relation X does not exists'.

My question is: why? Shouldn't DDL be executed immediately?

Thank you for your response,
Giuseppe Sacco


pgsql-jdbc by date:

Previous
From: fake@dusk.homelinux.org
Date:
Subject: Re: jdbc/callable statment error]
Next
From: Kris Jurka
Date:
Subject: Re: DDL in transactions?