Re: Statement.setQueryTimeout() with autoCommit=false - Mailing list pgsql-jdbc
From | Dave Cramer |
---|---|
Subject | Re: Statement.setQueryTimeout() with autoCommit=false |
Date | |
Msg-id | CADK3HHJQh8oNdn=Dxd6+jLF0BDguv9jfj-DY9ZSvicp6YWsduw@mail.gmail.com Whole thread Raw |
In response to | Re: Statement.setQueryTimeout() with autoCommit=false (Pavel Arnošt <pavel.arnost@loutka.cz>) |
List | pgsql-jdbc |
That little detail helps
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
Dave
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Thu, Dec 6, 2012 at 3:25 PM, Pavel Arnošt <pavel.arnost@loutka.cz> wrote:
That insert was against PostgreSQL server with synchronous replication and dead slave.> On Thu, Dec 6, 2012 at 1:36 PM, David Johnston <pol...@yahoo.com> wrote:
On Thursday, December 6, 2012 9:18:48 PM UTC+1, Dave Cramer wrote:
> Well my point was that that insert statement shouldn't last long enough to time out ?
>
>
> Dave
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
>
>
>
>
>
>
>
>
> > -----Original Message-----
>
> > From: pgsql-jd...@postgresql.org [mailto:pgsql-jdbc-
>
> > ow...@postgresql.org] On Behalf Of dmp>> > To: pgsql...@postgresql.org
> > Sent: Thursday, December 06, 2012 1:15 PM
>
>
> > Cc: pavel....@loutka.cz> > > On Thu, Dec 6, 2012 at 12:04 PM, <pavel....@loutka.cz>
> > Subject: Re: [JDBC] Statement.setQueryTimeout() with autoCommit=false
>
> >
>
> > Exactly.
>
> >
>
> > According to the Java API:
>
> >
>
> > void setAutoCommit(boolean autoCommit) throws SQLException
>
> >
>
> > Sets this connection's auto-commit mode to the given state. If a
>
> > connection is in auto-commit mode, then all its SQL statements will be
>
> > executed and committed as individual transactions. Otherwise, its SQL
>
> > statements are grouped into transactions that are terminated by a call to
>
> > either the method commit or the method rollback. By default, new
>
> > connections are in auto-commit mode.
>
> >
>
> > By setting setAutoCommit(false) you are deciding to tell the database your
>
> > code will determine when to commit the transaction. Thereby I would say
>
> > overiding setQueryTimeout().
>
> >
>
> > danap.
>
>
>
> Even within an manually administered transaction the setting of
>
> "setQueryTimeout()" will (should?) act on the individual statements that
>
> make up the transaction. If any individual statement within the transaction
>
> exceeds the limit that statement will fail and thus put the transaction into
>
> a "failed" state where a rollback (possibly to savepoint) is required. The
>
> transaction itself does not constitute a statement and as such it can run
>
> indefinitely long regardless of the presence of a statement timeout.
>
>
>
> David J.
>
>
>
>
>
> >
>
> > Dave Cramer wrote:
>
> > > Why would the query timeout at all ?
>
> > >
>
> > > The query timeout is for long running queries. If the query takes
>
> > > longer than n seconds it will timeout.
>
> > >
>
> > > Dave
>
> > >
>
> > > Dave Cramer
>
> > >
>
> > > dave.cramer(at)credativ(dot)ca
>
> > > http://www.credativ.ca
>
> > >
>
> > >
>
> > >
>>> > Sent via pgsql-jdbc mailing list (pgsql...@postgresql.org) To make
> > > <mailto:pavel....@loutka.cz>> wrote:
>
> > >
>
> > > Hi,
>
> > >
>
> > > does setQueryTimeout work with autoCommit=false? When autoCommit
>
> > is
>
> > > true, this code timeouts after 5 seconds (as expected):
>
> > >
>
> > > ~
>
> > > ~
>
> > > ~
>
> > > --
>
> > >
>
> > > But if I set autoCommit to false, this code timeouts after 30
>
> > > seconds on read timeout:
>
> > >
>
> > > --
>
> > > ~
>
> > > ~
>
> > > ~
>
> > > --
>
> > >
>
> > > I'm confused what's setQueryTimeout() method for, why it doesn't
>
> > > work with manual transactions?
>
> >
>
> >
>
> > --
>>> Sent via pgsql-jdbc mailing list (pgsql...@postgresql.org)
> changes
>
> > to your subscription:
>
> > http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
>
>
>
>
>
> --
>>
> To make changes to your subscription:
>
> http://www.postgresql.org/mailpref/pgsql-jdbc
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
pgsql-jdbc by date: