public boolean isValidDataSourceConnection(final CloseableDataSource ds, final int timeout) {
        try (val con = ds.getConnection()) {
            return con.isValid(timeout);
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }
        return false;
    }
Is valid data source connection.

@param ds      the ds
@param timeout the timeout
@return true/false
support/cas-server-support-jpa-util/src/main/java/org/apereo/cas/configuration/support/JpaBeans.java