From: | Pushker Chaubey <pchaubey(at)vertex(dot)co(dot)in> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Connection breaks with in transaction with a commit |
Date: | 2008-04-08 11:54:23 |
Message-ID: | 47FB5CEF.6080501@vertex.co.in |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
I am new to postgres and jdbc.
I am facing a very strange problem. I initiate a transaction with
con.setAutocommitOn(false). My transaction contains two prepare
statements (first one is select, second one is update query) and then a
batch query of prepared insert statements. It executes first two
statements successfully and then while preparing the next
prepareStatement, the connection breaks and commits the data updated so
far in the transaction. I am using connection pooling feature provided
by provided by Tomcat.
The most annoying part is, it does not happen always. It just happens
some times and keeps on giving error for next few trials and then
suddenly starts working correctly.
I do not understand why connection is breaking suddenly and why is it
committing the data before the transaction completes.
The connection always break at the same point in code. if accidentally
the same connection were passed to concurrent threads and it were being
closed and committed by some other thread, it could have broken at any
point in the code. But it always happens on the same line of code
whenever it happens.
Am I missing setting certain required parameters?
first few lines from the trace,
java.sql.SQLException: Connection is closed. at
org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:245)
at
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
Please suggest me a solution.
Thanks in advance,
Pushker Chaubey
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy the original message all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2008-04-08 18:22:13 | Re: Connection breaks with in transaction with a commit |
Previous Message | Craig Ringer | 2008-04-07 14:50:54 | Re: PostgreSQL FUNCTION return problem |