Обсуждение: Re: java.sql.SQLException: ERROR: canceling query due

Поиск
Список
Период
Сортировка

Re: java.sql.SQLException: ERROR: canceling query due

От
"Kevin Grittner"
Дата:
So you would add a variable to the statement class to save to when the set method is invoked, return this value from
theget method, and when an execute method is invoked, if the value is non-zero, you would bracket what is currently
sentto the server with a SET to the non-zero value and back to zero (in a finally clause)? 

>>> Kris Jurka <books@ejurka.com> 08/19/05 12:08 PM >>>


On Fri, 19 Aug 2005, Kevin Grittner wrote:

> I'm curious whether "SET statement_timeout=n" sets this for a
> connection.  If so, wouldn't it be a good thing to update the JDBC
> setQueryTimeout and getQueryTimeout methods to use these SET and SHOW
> statements?
>

Yes, it sets it per connection, but the problem is that the JDBC level
needs it per Statement.  So we'd have to set/reset it for each command.
I was originally concerned about thread safety and transactions, but
thinking about it some more now the monitor around QueryExecutorImpl
should protect against that.  Maybe this is easier than I thought.

Kris Jurka



Re: java.sql.SQLException: ERROR: canceling query due

От
Kris Jurka
Дата:

On Fri, 19 Aug 2005, Kevin Grittner wrote:

> So you would add a variable to the statement class to save to when the
> set method is invoked, return this value from the get method, and when
> an execute method is invoked, if the value is non-zero, you would
> bracket what is currently sent to the server with a SET to the non-zero
> value and back to zero (in a finally clause)?
>

Right.  Setting it back to zero doesn't even need to happen in the error
path because an error requires ROLLBACK and that will reset the
statement_timeout setting as well.

Kris Jurka