Re: getAutocommit assertion error

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Adrien Ruffie <adriennolarsen(at)hotmail(dot)fr>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: getAutocommit assertion error
Date: 2018-11-14 13:33:40
Message-ID: CADK3HHKcuZGPdu7ECHZKymCiMT-BpN1C7XDJuYA_t5Hz+yzOJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Adrien,

No reason not to use the latest

42.2.5

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On Wed, 14 Nov 2018 at 08:32, adrien ruffie <adriennolarsen(at)hotmail(dot)fr>
wrote:

> Sorry for this late anwser ...
>
> Dave, for the version of driver is:
>
>
> <groupId>org.postgresql</groupId>
> <artifactId>postgresql</artifactId>
> <version>42.2.2</version>
>
> Jens,
>
> I can't debug, because the problem only appears when bamboo lannched my
> test cases ... impossible to reproduce IDE and Maven command line ...
>
>
> ------------------------------
> *De :* Jens Carlberg <jens(dot)carlberg(at)gmail(dot)com>
> *Envoyé :* mardi 13 novembre 2018 10:11:32
> *À :* pgsql-jdbc(at)lists(dot)postgresql(dot)org
> *Objet :* Re: getAutocommit assertion error
>
> After looking at the JDBC code, the only path I see leading to this error
> is if the connection has been closed. If nothing else, this might give you
> a clue where to look in your test code.
>
> Best Regards,
> ///Jens Carlberg
>
> On Tue, 13 Nov 2018 at 09:39, Jens Carlberg <jens(dot)carlberg(at)gmail(dot)com>
> wrote:
>
> Hi.
>
> If you can, I suggest you run in debug and put a breakpoint in the method,
> so you can examine the thrown exception (or trace the call deeper). In
> Eclipse, it would be Run -> Debug As -> Maven Test (assuming this is when
> you run the tests). I have no experience in how to do this in other
> environment, but I assume other IDE:s at least have similar functionality.
> If you are using maven on the command line, this thread on StackOverflow
> might be helpful:
> https://stackoverflow.com/questions/2935375/debugging-in-maven
>
> Best Regards,
> ///Jens Carlberg
>
>
> On Tue, 13 Nov 2018 at 09:19, adrien ruffie <adriennolarsen(at)hotmail(dot)fr>
> wrote:
>
> Hello Dave,
>
> thank you for your advise, but unfortunately that not really change ...
> even by reversing the 2 lines, I still have the problem.
>
> It's very strange in source code
>
> private booleanisAutoCommit() {
> try {
> return pgStatement.getConnection().getAutoCommit();
> } catch (SQLException e) {
> assert false : "pgStatement.getConnection().getAutoCommit() should not
> throw";
> return false;
> }
> }
>
> because you can't really see the really SQLException which should throws
> in order ot really debug the problem ...
> I have tried to find in postgres site, in jdbc driver topic and thread in
> internet but nothing :-(
>
> ------------------------------
> *De :* adrien ruffie <adriennolarsen(at)hotmail(dot)fr>
> *Envoyé :* lundi 12 novembre 2018 14:10:50
> *À :* pgsql-jdbc(at)lists(dot)postgresql(dot)org
> *Objet :* getAutocommit assertion error
>
>
> Hello all,
>
>
> in my java test case launched by maven I get the following exception:
>
>
> java.lang.AssertionError: pgStatement.getConnection().getAutoCommit()
> should not throw
>
> But I don't know why this error is returned ...
>
> In my class, I set auto commit to 'false' value, and I commit at the
> ending like this:
>
>
> try {
> preparedStatement.close();
> connection.commit();
> } catch (SQLException e) {
> log.error("Error while closing connection.", e.toString());
> }
>
> I check where the error comme from and I just found the following code, in
> BatchResultHandler:
>
>
> private boolean isAutoCommit() {
> try {
> return pgStatement.getConnection().getAutoCommit();
> } catch (SQLException e) {
> assert false : "pgStatement.getConnection().getAutoCommit() should
> not throw";
> return false;
> }
> }
>
>
>
> I don't really understand the problem ...
>
> anyone can help me please ?
>
>
> Best regards,
>
>
> Adrien
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message adrien ruffie 2018-11-14 14:08:19 RE: getAutocommit assertion error
Previous Message adrien ruffie 2018-11-14 13:32:36 RE: getAutocommit assertion error