Search in sources :

Example 1 with OracleCachedRowSet

use of oracle.jdbc.rowset.OracleCachedRowSet in project adempiere by adempiere.

the class CCachedRowSet method getRowSet.

//	get
/**
	 * 	Get and Execute Row Set.
	 * 	No parameters, Read-Only, Scroll Insensitive
	 *	@param sql sql
	 *	@param conn connection
	 *	@param db database
	 *	@return row set
	 *	@throws SQLException
	 */
public static RowSet getRowSet(String sql, Connection conn, AdempiereDatabase db) throws SQLException {
    if (db.getName().equals(Database.DB_ORACLE)) {
        Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        ResultSet rs = stmt.executeQuery(sql);
        OracleCachedRowSet crs = new OracleCachedRowSet();
        crs.populate(rs);
        rs.close();
        stmt.close();
        return crs;
    }
    CachedRowSet crs = get();
    crs.setConcurrency(ResultSet.CONCUR_READ_ONLY);
    crs.setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
    crs.setCommand(sql);
    crs.execute(conn);
    return crs;
}
Also used : OracleCachedRowSet(oracle.jdbc.rowset.OracleCachedRowSet) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) OracleCachedRowSet(oracle.jdbc.rowset.OracleCachedRowSet) CachedRowSet(javax.sql.rowset.CachedRowSet)

Example 2 with OracleCachedRowSet

use of oracle.jdbc.rowset.OracleCachedRowSet in project adempiere by adempiere.

the class CCachedRowSet method getRowSet.

//	get
/**
	 * 	Get Cached Row Set.
	 * 	Required due to Java Sun bug 393865. 
	 * 	Also, Oracle NUMBER returns scale -127 
	 * 	@param rs result set
	 * 	@param db database 
	 *	@return Cached Row Set
	 *	@throws SQLException
	 */
public static RowSet getRowSet(ResultSet rs, AdempiereDatabase db) throws SQLException {
    if (db.getName().equals(Database.DB_ORACLE)) {
        OracleCachedRowSet crs = new OracleCachedRowSet();
        crs.populate(rs);
        return crs;
    }
    CachedRowSet crs = get();
    crs.populate(rs);
    return crs;
}
Also used : OracleCachedRowSet(oracle.jdbc.rowset.OracleCachedRowSet) OracleCachedRowSet(oracle.jdbc.rowset.OracleCachedRowSet) CachedRowSet(javax.sql.rowset.CachedRowSet)

Aggregations

CachedRowSet (javax.sql.rowset.CachedRowSet)2 OracleCachedRowSet (oracle.jdbc.rowset.OracleCachedRowSet)2 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1