Connections to MySQL servers can automatically time-out according to the
configured within the MySQL server.
To prevent these connections being automatically closed, the connector
can be configured to keep the connection alive by submitting a simple
SELECT statement (actually
SELECT 'KEEP_ALIVE') periodically
to ensure that the MySQL timeout is not reached and the connection
Two parameters configure the keepalive functionality:
The interval used to check for idle connections. If set to a value of 0, the keep alive check is disabled. Any value greater than zero is the interval check period in seconds.
The keep-alive statement is submitted if the time since the last activity reaches this timeout value.
The default setting for both parameters is
When set to
default, the values are automatically calculated by the connector
computing suitable values based on the
configured in the MySQL server.
connection.keepAlive.interval = (int) Math.floor(wait_timeout * 0.10); connection.keepAlive.timeout = (int) Math.floor(wait_timeout * 0.7);
tpm update alpha --property=connection.keepAlive.interval=30