Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggK0-00008h-5C for pgsql-jdbc@arkaria.postgresql.org; Thu, 06 Dec 2012 18:37:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TggJy-0001f6-VE for pgsql-jdbc@arkaria.postgresql.org; Thu, 06 Dec 2012 18:37:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggJp-0001XW-Kq for pgsql-jdbc@postgresql.org; Thu, 06 Dec 2012 18:37:09 +0000 Received: from nm7-vm0.bullet.mail.bf1.yahoo.com ([98.139.213.151]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggJl-00064y-Go for pgsql-jdbc@postgresql.org; Thu, 06 Dec 2012 18:37:09 +0000 Received: from [98.139.212.153] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 06 Dec 2012 18:37:03 -0000 Received: from [76.13.13.40] by tm10.bullet.mail.bf1.yahoo.com with NNFMP; 06 Dec 2012 18:37:03 -0000 Received: from [127.0.0.1] by smtp101.prem.mail.ac4.yahoo.com with NNFMP; 06 Dec 2012 18:37:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1354819023; bh=5GHZGTxcQD+gnslXdAlOB2JzEBvAbTDLFMt5WRGf1yo=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:Content-Language; b=6Y2HVGAbbj6+TZhrHiduPPd4RIeEgVPW9unJmE5iqgX78JBfpoy4JdASSHAXLBuJ6B4asPTB45CLZWpsb7E9/3db4TF6t0NMb0ezwo8uw0LOwTPUFckD/PTzXa/rjDPzI2oyRtlqWcpokX/IIMQBqljZz+4B5IHdVF8lR7XXlGg= X-Yahoo-Newman-Id: 227864.46335.bm@smtp101.prem.mail.ac4.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: wpDBwn4VM1mlp4QVk3NrEk0hic4S_90t.sSBrQ6fLtyx_Ia awAdYYU9uI63xC5dru_yfWimWBsm3kcBfyKNIS_sPBu4u7fA85ZJi.PyFulb iNE0SI8gsWi6icT2c.sa0PU_8YoXCiV_3GJxNAkQw.E6CIpKFxlfvM_7ZHv2 QRYcrXyFfxPDKrQLucnbVA5CMSshrgcitGbwbQcymW6fr.Qlo4gErxWAD2rj xIkgIAcyuJFIUyr6OAYCkxKZqwFaznjTUK0JzV96lYHAXD1l9jZeCx3VZu_N 3104p7Nuciz9IjiRFS9DgGKS1O1snvf0WuHQsOwgN.NO.a1g2bTHBepksUHQ CQDrKJztzzoWEhb8.IRGU7RIc4qz7c9wlL00tFaRJPsPeB.SkNgeash72VLB Hp75qerUaOHorvGFj2YnxigoCR2QNiDXDpKRnvnPlehTdSkOHz0lIzB2S9KH seSV2tFz1xX2POIBbTfNXcDFFsh8ZUAiF_ucuzHJETP0KF3k14XpfW6SGxb5 nQ1I- X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.28.86 with login) by smtp101.prem.mail.ac4.yahoo.com with SMTP; 06 Dec 2012 10:37:03 -0800 PST From: "David Johnston" To: "'dmp'" , Cc: References: <5097e057-c9b9-42f0-bed0-219eab05bb7d@googlegroups.com> <50C0E09A.4070408@ttc-cmc.net> In-Reply-To: <50C0E09A.4070408@ttc-cmc.net> Subject: Re: Statement.setQueryTimeout() with autoCommit=false Date: Thu, 6 Dec 2012 13:36:53 -0500 Message-ID: <014101cdd3e0$a9a302a0$fce907e0$@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQF71Xk46Ti56BxJT15wxGI4l97bCgL5hfPWAUAjiNeYjkfGMA== Content-Language: en-us X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc- > owner@postgresql.org] On Behalf Of dmp > Sent: Thursday, December 06, 2012 1:15 PM > To: pgsql-jdbc@postgresql.org > Cc: pavel.arnost@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 > > > > > > > > On Thu, Dec 6, 2012 at 12:04 PM, > > 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-jdbc@postgresql.org) 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