use of oracle.jdbc.OraclePreparedStatement 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();
}
use of oracle.jdbc.OraclePreparedStatement in project translationstudio8 by heartsome.
the class TMDatabaseImpl method insertTMXProp.
/**
* 将数据插入TMXPROPS表
* @param params
* ;
* @throws SQLException
*/
public void insertTMXProp(Map<String, String> params) throws SQLException {
OraclePreparedStatement stmt = null;
try {
String sql = dbConfig.getOperateDbSQL("insert-tmxprops");
stmt = (OraclePreparedStatement) conn.prepareStatement(sql);
int i = 1;
stmt.setString(i++, params.get("PARENTNAME"));
stmt.setInt(i++, Integer.parseInt(params.get("PARENTID")));
stmt.setString(i++, params.get("TYPE"));
stmt.setString(i++, params.get("LANG"));
stmt.setString(i++, params.get("ENCODING"));
stmt.setStringForClob(i++, params.get("CONTENT"));
stmt.executeUpdate();
} finally {
if (stmt != null) {
stmt.close();
}
}
}
Aggregations