1

I have a project that is, intermittently, changing the time_zone value from a user defined value, to SYSTEM, and I am trying to determine if MySQL considers 'the current session' (MySQL TimeZone) the connection, or, the workstation IP that the connection is coming from.

Basically, if it's not per connection, then something else is connecting to MySQL and changing the time_zone value back to SYSTEM, which is then having an impact on my already connected software.

If it is per connection, then I am back to trying to figure out WHERE the time_zone is being reset.

For further info, my project is written in Delphi XE3, using the MyDAC components for DB connections. When the project loads, I read a connection file and, if there is a time_zone string set, I execute the 'Set Time_zone' query. The connection stays active through-out the applications run lifetime and is global to the application (i.e. I don't create/connect other connections from this application to the DB).

Thanks for your assistance!

ConBran
  • 369
  • 2
  • 15
  • A session is a connection. – Barmar Sep 22 '15 at 15:40
  • Does your session go idle for long periods of time? The server may be disconnecting you after a timeout, and the Delphi library may re-connect automatically. Session settings will be lost when that happens. – Barmar Sep 22 '15 at 15:41

1 Answers1

1

A MySQL session corresponds to a connection.

The MySQL server automatically disconnects idle sessions after a timeout, based on the value of the system variable wait_timeout, which defaults to 28800 seconds (8 hours). It sounds like Delphi is automatically reconnecting your session, but per-session settings will be lost when this happens.

You should change your application so that it sends the timezone setting if it has been idle for a long period of time. You could also increase the wait_timeout (the maximum value is 2147483, 24.85 days).

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Thanks, that's what I figured, just wanted to get it clarified before I went down a rabbit hole of code that had NOTHING to do with my issue - I'll have to add something to the MyDAC component to detect the reconnect and resend the time_zone information – ConBran Sep 22 '15 at 15:50