Applies to:
- Liquibase Pro
- Liquibase Community
Environment Conditions:
- Liquibase version: Any version
- Database: MariaDB or MySQL
- Extension: Liquibase Percona extension
Summary:
When connecting to MariaDB or MySQL using the Liquibase Percona extension, there is an ability to modify the wait_timeout to keep a connection alive. This can be done either by setting the wait_timeout value on the database/server-side or setting it in the JDBC URL.
By default, Liquibase will keep the connection alive at half the value set for the wait_timout, so if the wait_timeout is set to 4 hours, Liquibase will send a network packet every 2 hours to keep the connection alive.
If you are using a firewall that terminates idle connections, the wait_time needs to be modified to accommodate that time set on the firewall.
How to Set the wait_timeout
Database/server side
- Either log into the database directly or use another tool to access the database.
- You can view the current value using the following query:
SHOW VARIABLES LIKE 'wait_timeout';
- Run the Set command to set the wait_timeout
SET GLOBAL wait_timeout = 300;
JDBC URL
The MariaDB/MySQL JDBC URL has an attribute called sessionVariable, which can be used to set the wait_timeout period.
jdbc:mysql://xxxx.xx.xx.xx/dbName?sessionVariables=wait_timeout=900
Comments
0 comments
Article is closed for comments.