DatabaseMetaData meta = conn.getMetaData(); String product = meta.getDatabaseProductName(); String version = meta.getDatabaseProductVersion(); if ("Oracle".equals(product) && (version.indexOf("9.0.1") != -1 || version.indexOf("9.2.0.1.0") != -1)) { final Statement stmt = conn.createStatement(); stmt.execute ("alter session set \"_push_join_union_view\" = false"); stmt.close(); }
    public static final Connection acquire(final String url) {        Assert.exists(url);        final int database = DbHelper.getDatabaseFromURL(url);        try {            switch (database) {            case DbHelper.DB_POSTGRES:                Classes.loadClass("org.postgresql.Driver");                break;            case DbHelper.DB_ORACLE:                Classes.loadClass("oracle.jdbc.driver.OracleDriver");                break;            }            final Connection conn = DriverManager.getConnection(url);            Assert.exists(conn, Connection.class);            conn.setAutoCommit(false);	    // XXX Use connection metadata to find out if this is the	    // bad oracle.  Do we need to do this this often?	    //if (false) {	    //    final PreparedStatement stmt = conn.prepareStatement	    //        ("alter session set \"_push_join_union_view\" = false");	    //    stmt.execute();	    //}            return conn;        } catch (SQLException e) {            throw new UncheckedWrapperException(e);        }    }