Hi,
I am new to postgres and jdbc.
I am facing a very strange problem. I initiate a transaction with=20
con.setAutocommitOn(false). My transaction contains two prepare=20
statements (first one is select, second one is update query) and then a=20
batch query of prepared insert statements. It executes first two=20
statements successfully and then while preparing the next=20
prepareStatement, the connection breaks and commits the data updated so=20
far in the transaction. I am using connection pooling feature provided=20
by provided by Tomcat.
The most annoying part is, it does not happen always. It just happens=20
some times and keeps on giving error for next few trials and then=20
suddenly starts working correctly.
I do not understand why connection is breaking suddenly and why is it=20
committing the data before the transaction completes.
The connection always break at the same point in code. if accidentally=20
the same connection were passed to concurrent threads and it were being=20
closed and committed by some other thread, it could have broken at any=20
point in the code. But it always happens on the same line of code=20
whenever it happens.
Am I missing setting certain required parameters?
first few lines from the trace,
java.sql.SQLException: Connection is closed. at=20
org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection=
..java:245)=20
at=20
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingCon=
nection.java:185)=20
Please suggest me a solution.
Thanks in advance,
Pushker Chaubey
=0D
The information contained in this electronic message and any attachments
to=
this message are intended for the exclusive use of the addressee(s) and
ma=
y contain proprietary, confidential or privileged information. If you are
n=
ot the intended recipient, you should not disseminate, distribute or copy
t=
his e-mail. Please notify the sender immediately and destroy the original
m=
essage all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
shoul=
d check this email and any attachments for the presence of viruses. The
com=
pany accepts no liability for any damage caused by any virus transmitted
by=
this email.
--=20
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc


|