| From: | Mark Rotteveel <mark(at)lawinegevaar(dot)nl> |
|---|---|
| To: | pgsql-jdbc(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Confusion regarding autocommit |
| Date: | 2019-04-10 12:28:28 |
| Message-ID: | 3c49b9c9-6fd1-9b52-3007-999041551960@lawinegevaar.nl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
On 10-4-2019 11:09, siddharth yanamandra wrote:
> Hi
>
> We have an application which used the jdbc 8.2-504 version. We have
> recently tried to update it to 42.2.5 jre 7 version. During this update
> we faced the issue "could not commit when autocommit is enabled" error
> so we have decided to assign false to autocommit during connection
> initiation. Now many of the SQL statements we use are select statements
> and we have read from many sources that even select statements should be
> committed to clear locks on tables. Is this necessary or is it ok to
> just close the connection after the operations are done(for select
> statements only).
The point of auto-commit mode is that this happens automatically. You
should not call commit() or rollback() when using auto-commit. If you
want to explicitly call commit or rollback, then you should disable
auto-commit using setAutoCommit(false).
Mark
--
Mark Rotteveel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mark Rotteveel | 2019-04-10 12:43:32 | Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type |
| Previous Message | siddharth yanamandra | 2019-04-10 09:09:49 | Confusion regarding autocommit |