Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggBv-0008Qv-E3 for pgsql-jdbc@arkaria.postgresql.org; Thu, 06 Dec 2012 18:28:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TggBu-0005gq-VN for pgsql-jdbc@arkaria.postgresql.org; Thu, 06 Dec 2012 18:28:59 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggBu-0005gl-Bz for pgsql-jdbc@postgresql.org; Thu, 06 Dec 2012 18:28:58 +0000 Received: from outbound.vnet-inc.com ([216.146.104.103]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TggBs-0002jD-20 for pgsql-jdbc@postgresql.org; Thu, 06 Dec 2012 18:28:57 +0000 Received: from [192.168.157.132] (unknown [76.75.27.41]) by outbound.vnet-inc.com (Postfix) with ESMTP id 60B9859B1; Thu, 6 Dec 2012 11:28:56 -0700 (MST) Message-ID: <50C0E09A.4070408@ttc-cmc.net> Date: Thu, 06 Dec 2012 11:14:50 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org CC: pavel.arnost@loutka.cz Subject: Re: Statement.setQueryTimeout() with autoCommit=false References: <5097e057-c9b9-42f0-bed0-219eab05bb7d@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 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. 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