Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Connection brea...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 1923 of 1994
Post > Topic >>

Connection breaks with in transaction with a commit

by pchaubey@[EMAIL PROTECTED] (Pushker Chaubey) Apr 8, 2008 at 05:24 PM

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
 




 2 Posts in Topic:
Connection breaks with in transaction with a commit
pchaubey@[EMAIL PROTECTED  2008-04-08 17:24:23 
Re: Connection breaks with in transaction with a commit
craig@[EMAIL PROTECTED]   2008-04-09 02:22:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:40:21 CDT 2008.