Currently JDBC storage plugin uses DBCP2 for the connection pooling, but it wouldn't validate the connection's still available or not, and it'd just spit the connection lost error.
We should be able to have a validationQuery option described here in Drill's JDBC storage plugin configuration.
DRILL-7639 BasicDataSource was replaced with Hikari, sourceParameters sections remains and allows to configure data source, Hikari related configuration properties should be used instead. List of Hikari properties: https://github.com/brettwooldridge/HikariCP.
connectionTestQuery should be used instead of validationQuery. Example of configuration: