views:

267

answers:

1

Suppose I have:

untimedStatement = connection.createStatement() ;
timedStatement = connection.createStatement();

And then run

timedStatement.execute("SET statement_timeout TO " + timeout);

Will the SET statement_timeout command also affect untimedStatement? I was hoping it would not but some of the behaviour I'm observing suggests that SET statement_timeout has a "universal" effect (at least for the life of the program)

+1  A: 

Yes, as long as they are executed on the same connection.

You can use SET LOCAL statement_timeout to make it affect only the current transaction. Details.

Magnus Hagander