Search in sources :

Example 1 with OracleConnection

use of oracle.jdbc.OracleConnection in project druid by alibaba.

the class OracleUtils method setImplicitCachingEnabled.

public static void setImplicitCachingEnabled(Connection conn, boolean cache) throws SQLException {
    OracleConnection oracleConn = unwrap(conn);
    oracleConn.setImplicitCachingEnabled(cache);
}
Also used : OracleConnection(oracle.jdbc.OracleConnection)

Example 2 with OracleConnection

use of oracle.jdbc.OracleConnection in project druid by alibaba.

the class OracleUtils method purgeImplicitCache.

public static void purgeImplicitCache(Connection conn) throws SQLException {
    OracleConnection oracleConn = unwrap(conn);
    oracleConn.purgeImplicitCache();
}
Also used : OracleConnection(oracle.jdbc.OracleConnection)

Example 3 with OracleConnection

use of oracle.jdbc.OracleConnection in project druid by alibaba.

the class OracleUtils method setDefaultRowPrefetch.

public static void setDefaultRowPrefetch(Connection conn, int value) throws SQLException {
    OracleConnection oracleConn = unwrap(conn);
    oracleConn.setDefaultRowPrefetch(value);
}
Also used : OracleConnection(oracle.jdbc.OracleConnection)

Example 4 with OracleConnection

use of oracle.jdbc.OracleConnection in project druid by alibaba.

the class TestOraclePing method test_o.

public void test_o() throws Exception {
    Class.forName(driverClass);
    Connection conn = DriverManager.getConnection(jdbcUrl, user, password);
    OracleConnection oracleConn = (OracleConnection) conn;
    for (int i = 0; i < 10; ++i) {
        ping_1000(oracleConn);
        select_1000(oracleConn);
    }
    conn.close();
}
Also used : Connection(java.sql.Connection) OracleConnection(oracle.jdbc.OracleConnection) OracleConnection(oracle.jdbc.OracleConnection)

Example 5 with OracleConnection

use of oracle.jdbc.OracleConnection in project druid by alibaba.

the class TestOraclePreparedStatement method test_0.

public void test_0() throws Exception {
    Connection conn = DriverManager.getConnection(jdbcUrl, user, password);
    OracleConnection oracleConn = (OracleConnection) conn;
    // ResultSet metaRs = conn.getMetaData().getTables(null, "ALIBABA", null, new String[] {"TABLE"});
    // JdbcUtils.printResultSet(metaRs);
    // metaRs.close();
    int fetchRowSize = oracleConn.getDefaultRowPrefetch();
    //        {
    //            oracleConn.setStatementCacheSize(10);
    //            oracleConn.setImplicitCachingEnabled(true);
    //
    //            PreparedStatement stmt = conn.prepareStatement(SQL);
    //            stmt.close();
    //            
    //            PreparedStatement stmt2 = conn.prepareStatement(SQL);
    //            stmt2.close();
    //        }
    OraclePreparedStatement oracleStmt = null;
    PreparedStatement stmt = conn.prepareStatement(SQL);
    oracleStmt = (OraclePreparedStatement) stmt;
    oracleStmt.setRowPrefetch(10);
    {
        stmt.setInt(1, 327);
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
        }
        rs.close();
    //oracleStmt.clearDefines();
    }
    for (int i = 0; i < 10; ++i) {
        OracleUtils.enterImplicitCache(oracleStmt);
        OracleUtils.exitImplicitCacheToActive(oracleStmt);
        stmt.setInt(1, 327);
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
        }
        rs.close();
    }
    oracleStmt.setRowPrefetch(1000);
    {
        stmt.setInt(1, 11);
        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.close();
        stmt.close();
    }
    conn.close();
}
Also used : Connection(java.sql.Connection) OracleConnection(oracle.jdbc.OracleConnection) ResultSet(java.sql.ResultSet) OraclePreparedStatement(oracle.jdbc.OraclePreparedStatement) OraclePreparedStatement(oracle.jdbc.OraclePreparedStatement) PreparedStatement(java.sql.PreparedStatement) OracleConnection(oracle.jdbc.OracleConnection)

Aggregations

OracleConnection (oracle.jdbc.OracleConnection)9 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 PreparedStatementHolder (com.alibaba.druid.pool.PreparedStatementHolder)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 OraclePreparedStatement (oracle.jdbc.OraclePreparedStatement)1 OraclePreparedStatement (oracle.jdbc.internal.OraclePreparedStatement)1