Re: getAutocommit assertion error

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: getAutocommit assertion error
Дата
Msg-id CADK3HHJuyouyS+_4sLF2HtEcF7wawoEuf+04L13fcxv9im2FYQ@mail.gmail.com
обсуждение исходный текст
Ответ на RE: getAutocommit assertion error  (adrien ruffie <adriennolarsen@hotmail.fr>)
Список pgsql-jdbc
Hello Adrien,

In that case I'd have to see a test case that replicates the problem in order to be able to help you 

Just curious what version of the driver are you using?

On Tue, 13 Nov 2018 at 03:19, adrien ruffie <adriennolarsen@hotmail.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@hotmail.fr>
Envoyé : lundi 12 novembre 2018 14:10:50
À : pgsql-jdbc@lists.postgresql.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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jens Carlberg
Дата:
Сообщение: Re: getAutocommit assertion error
Следующее
От: adrien ruffie
Дата:
Сообщение: RE: getAutocommit assertion error