RE: getAutocommit assertion error

From: adrien ruffie <adriennolarsen(at)hotmail(dot)fr>
To: "pgsql-jdbc(at)lists(dot)postgresql(dot)org" <pgsql-jdbc(at)lists(dot)postgresql(dot)org>
Subject: RE: getAutocommit assertion error
Date: 2018-11-13 08:19:29
Message-ID: VI1P191MB031912C59505A8CC012F172AA9C20@VI1P191MB0319.EURP191.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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 Jens Carlberg 2018-11-13 08:39:52 Re: getAutocommit assertion error
Previous Message Dave Cramer 2018-11-12 22:43:48 Re: getAutocommit assertion error