Re: getAutocommit assertion error

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: adriennolarsen(at)hotmail(dot)fr
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: getAutocommit assertion error
Date: 2018-11-12 22:43:48
Message-ID: CADK3HHLrWbfczb=NX0=AsgNuDHWHK8yM9vZKpdpKKK_CfpjUYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

My best guess is that you should be committing before closing the statement.

Dave Cramer

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

On Mon, 12 Nov 2018 at 09:39, adrien ruffie <adriennolarsen(at)hotmail(dot)fr>
wrote:

> 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

Browse pgsql-jdbc by date

  From Date Subject
Next Message adrien ruffie 2018-11-13 08:19:29 RE: getAutocommit assertion error
Previous Message adrien ruffie 2018-11-12 13:10:50 getAutocommit assertion error