X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3929ED1B196 for ; Mon, 10 May 2004 15:05:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 54188-07 for ; Mon, 10 May 2004 15:04:43 -0300 (ADT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 8B766D1B176 for ; Mon, 10 May 2004 15:04:38 -0300 (ADT) Received: (qmail 9408 invoked from network); 10 May 2004 18:04:35 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 10 May 2004 18:04:35 -0000 Subject: Re: problem with transactions From: Dave Cramer Reply-To: pg@fastcrypt.com To: pginfo Cc: Barry Lind , "pgsql-jdbc@postgresql.org" In-Reply-To: <409FAEE0.3000204@t1.unisoftbg.com> References: <409F6ED2.1050701@t1.unisoftbg.com> <409FA4CB.6070305@xythos.com> <409F9C46.9050906@t1.unisoftbg.com> <1084207760.1541.67.camel@localhost.localdomain> <409FAEE0.3000204@t1.unisoftbg.com> Content-Type: text/plain Organization: Cramer Consulting Message-Id: <1084212274.1540.72.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Mon, 10 May 2004 14:04:35 -0400 Content-Transfer-Encoding: 7bit X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/46 X-Sequence-Number: 10056 Ivan, First I would try to find out if the connection is being wrapped by another class. Probably is, then hunt around in that class to see why the rollback is not being issued right away. Why are you doing select count(*) exactly. They are very expensive operations. Dave On Mon, 2004-05-10 at 12:33, pginfo wrote: > Dave Cramer wrote: > > >It is in the conf file, and then you need to restart postgres > > > >DAve > >On Mon, 2004-05-10 at 11:14, pginfo wrote: > > > > > >>Barry Lind wrote: > >> > >> > >> > >>>I would suggest that you turn on sql statement logging on your > >>>database server and see exactly what the jdbc driver is sending to the > >>>server. I suspect this information will help you track down the problem. > >>> > >>>thanks, > >>>--Barry > >>> > >>> > >>>pginfo wrote: > >>> > >>> > >>> > >>>>Hi, > >>>> > >>>>We are using pg 7.4.2 + jdbc to connect to jboss. > >>>> > >>>>It looks that pg have problems with transactions and jdbc. > >>>> > >>>>My example: > >>>> > >>>>Connection con = ... I get connection to my db. > >>>> > >>>>con.setAutoCommit(false); // begin transaction > >>>> > >>>>// do some inserts > >>>> > >>>>con.rollback(); // rollback > >>>> > >>>>After this code all is working very well. > >>>>All inserts are rollbacked and so on. > >>>> > >>>>And now the second example: > >>>> > >>>>Connection con = ... I get connection to my db. > >>>> > >>>>con.setAutoCommit(false); // begin transaction > >>>> > >>>>// do some inserts > >>>> > >>>>con.rollback(); // rollback > >>>>con.setAutoCommit(true); // set autocommit. We are using > >>>>connection pool and will to have clear connection. > >>>> > >>>>For my supprice the last example do not rollback any inserts ! > >>>>I do not see nothink bad in this code, and also it is working perfect > >>>>on oracle + jdbc and also MSSQL + jdbc. > >>>> > >>>>Pls., can some one check the situation and post the result. > >>>> > >>>>I tryed to insert sole sllep for 5 sec. before the last > >>>>con.setAutoCommit(true); , but it do not help. > >>>> > >>>>Is it bug into the jdbc or pg ? > >>>> > >>>>I tested it also with pg 7.4.1 and 7.4. and I have the same problem. > >>>> > >>>>regards, > >>>>ivan. > >>>> > >>>> > >>>>---------------------------(end of broadcast)--------------------------- > >>>>TIP 8: explain analyze is your friend > >>>> > >>>> > >>> > >>> > >>> > >>> > >>> > >>How to do it? > >>Will I need to recompile pg or I can set it up into conf-file? > >> > >> > >>---------------------------(end of broadcast)--------------------------- > >>TIP 4: Don't 'kill -9' the postmaster > >> > >> > >> > >> > >> > >> > >> > >> > Hi, > > I am ready with first results from my test. > I send a part of my pg log with comments: > > I make getConnection(); > LOG: statement: rollback; begin; > > I only check the count to be sure that the command is executed in place. > LOG: statement: select count(*) from tt > > conn.setAutoCommit(false); > LOG: statement: begin; > > Test the value from my table. It is as expected. > LOG: statement: select count(*) from tt > > Insert new row. > LOG: statement: insert into tt values (1) > > Check the new count. It is ok. > LOG: statement: select count(*) from tt > > !!! I make conn.rollbac(), but do not find any command in my pg LOG ! It > is big mistake. I think by jboss, but I am not sure for now. > > I check the value after rollback and it is wrong. > LOG: statement: select count(*) from tt > > I close the connection. Jboss sends rollback now! I do not know why for now. > LOG: statement: rollback; begin; > > > Any idea how to search the problem? > Of course I can close connection instead rollback, but it is not the > best solution. > > regards, > ivan. > > > > !DSPAM:409fc09161237423516082! > > -- Dave Cramer 519 939 0336 ICQ # 14675561