Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: Controlling query timeout period for deadlocks and long running queries


Advanced Search

Controlling query timeout period for deadlocks and long running queries
Posted by: David Wynter ()
Date: June 03, 2005 11:09AM

Hi,

Could not find a reference for how to do this. For lock timeouts in SQL Server I used to use this
timeoutStmt.executeUpdate("SET LOCK_TIMEOUT 20000");
This then works for just that connection. I catch the SQLException and test for
se.getErrorCode() == 1222
1222 being the native SQL server error code for a lock timeout.

How do I do the same in MySQL using JDBC? I was going to use
timeoutStmt.executeUpdate("SET @@session.wait_timeout = 20000");
until I realised wait_timeout is not related to the query but the connection.

Also of interest is when a query just takes too long, shouldn't happen, but I'd like to allow for it. Is there some way of setting a limit and a particular error code used when it is expired?

Thx.

David

Options: ReplyQuote


Subject Written By Posted
Controlling query timeout period for deadlocks and long running queries David Wynter 06/03/2005 11:09AM
Re: Controlling query timeout period for deadlocks and long running queries David Wynter 06/03/2005 01:36PM
Re: Controlling query timeout period for deadlocks and long running queries Dirk B. 02/23/2006 10:35AM
Re: Controlling query timeout period for deadlocks and long running queries Mark Matthews 02/23/2006 06:23PM
Re: Controlling query timeout period for deadlocks and long running queries omprakash 02/01/2007 02:41PM
Re: Controlling query timeout period for deadlocks and long running queries Mark Matthews 02/01/2007 03:24PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.