getAutocommit assertion error - Mailing list pgsql-jdbc

From adrien ruffie
Subject getAutocommit assertion error
Date
Msg-id VI1P191MB0319DC74465B486ACF950335A9C10@VI1P191MB0319.EURP191.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: getAutocommit assertion error  (Dave Cramer <pg@fastcrypt.com>)
RE: getAutocommit assertion error  (adrien ruffie <adriennolarsen@hotmail.fr>)
List pgsql-jdbc

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

pgsql-jdbc by date:

Previous
From: Alexander Kjäll
Date:
Subject: Re: Maybe time for an alpha release of the pgsql2 project
Next
From: Dave Cramer
Date:
Subject: Re: getAutocommit assertion error