class DatabaseConnectionFactory {

    public static IDatabaseConnection openConnection(final BasicDataSource ds) {
        try {
            final Connection connection = ds.getConnection();

            for (final DbUnitConnectionFactory impl : SERVICE_LOADER) {
                if (impl.supportsDriver(ds.getDriverClassName())) {
                    return impl.createConnection(connection, discoverSchema(connection));
                }
            }

            // fall back if no specific implementation is available
            return new DatabaseConnection(connection);
        } catch (final DatabaseUnitException | SQLException e) {
            throw new JpaUnitException(e);
        }
    }

    private  DatabaseConnectionFactory();

}