public static int countEntity(final Connection connection, final String tableName) {
        try (final Statement statement = connection.createStatement()) {
            try (final ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM " + tableName)) {
                if (resultSet.next()) {
                    return resultSet.getInt(1);
                }
            }
        } catch (final SQLException e) {
            throw new RuntimeException(e.getMessage(), e);
        }

        return 0;
    }
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