Re: What is the longevity of a "SET SESSION" statement?
Posted by: Todd Farmer
Date: November 24, 2014 10:51AM

Hi Dakota,

Session-scoped variables get set for the duration of the connection, with two exceptions: COM_CHANGE_USER and COM_RESET_CONNECTION are two protocol commands which trigger session variables to be dropped. These are sometimes used by connection pool libraries to ensure a "clean" session state between application check-outs of the Connection object.

Besides that, session-scoped variables are tied to the *physical* connection, which can be replaced inside a logical Connection object for several reasons:

* Failure handled by autoReconnect=true
* Load-balancing, replication or shard-aware deployments

I'd look for one of two things happening:

1. The session variable is being explicitly set by some unknown code elsewhere, overwriting the code you know about (enable and check MySQL general query log to evaluate).

2. The connection state is being modified underneath your logical Connection.

Hope that helps!

Todd Farmer
MySQL @ Oracle

Options: ReplyQuote

Written By
Re: What is the longevity of a "SET SESSION" statement?
November 24, 2014 10:51AM

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.