public static boolean doesTableExist(final Connection connection, final String tableName) {
        try {
            final String catalog = connection.getCatalog(); // AKA the mysql DB in use
            final String schema = connection.getSchema();
            LOGGER.debug("doesTableExist - catalog: {}, schema: {}, tableName: {}", catalog, schema, tableName);
            final DatabaseMetaData meta = connection.getMetaData();
            try (ResultSet tables = meta.getTables(
                    catalog, schema, tableName, null)) {
//                boolean found = false;
//                while (tables.next()) {
//                    found = true;
//                    final String tblCat = tables.getString("TABLE_CAT");
//                    final String tblSchema = tables.getString("TABLE_SCHEM");
//                    final String tblName = tables.getString("TABLE_NAME");
//                    LOGGER.info("tblCat: {}, tblSchema: {}, tableName: {}", tblCat, tblSchema, tblName);
//                }
//                return found;
                return tables.next();
            }
        } catch (SQLException e) {
            throw new RuntimeException(
                    LogUtil.message("Error establishing if table {} exists in the database.", tableName), e);
        }
    }
Attempts to connect to the database using the passed connection details. If it fails
it will log a warning, and keep retrying. The retry interval will steadily increase.
<p>
If the connection could not be established and the reason for the failure makes a
retry pointless, e.g. invalid password, then an exception will be thrown.
stroom-db-util/src/main/java/stroom/db/util/DbUtil.java