DDL hanging when different connection is left open

From: Nathan McEachen <nathan(at)mceachen(dot)us>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: DDL hanging when different connection is left open
Date: 2006-01-24 02:48:03
Message-ID: 43D59563.1040702@mceachen.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


In order to execute a DDL statement on a table using a JDBC
connection, must all other JDBC connections that have performed a read
query on that table be closed?

This is what I am seeing:

connection1 performes query: "SELECT * FROM my_table";
connection 2 performs DDL: "ALTER TABLE my_table ADD COLUMN my_col INTEGER";

connection 2 seems to hang unless connection1 is closed (i.e.
conneciton1.close() ).

This is proving to be a problem when I pool my JDBC connections in my
application, as connections that are returned to the pool are not
closed. I tried chaning the transaction isolation levels through JDBC
but that did not change anything.

Is there a way for me to keep my JDBC connections open, yet still
perform DDL statements?

Thanks in advance,

-Nathan

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

--Jan L.A. van de Snepscheut

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2006-01-24 03:02:33 Re: DDL hanging when different connection is left open
Previous Message Dave Cramer 2006-01-23 20:27:18 Re: RFP: Finish JDBC driver