OracleDataSource dataSource = new OracleDataSource();
dataSource.setURL("jdbc:oracle:thin:@localhost:1521:orcl");
dataSource.setUser("username");
dataSource.setPassword("password");
dataSource.setConnectionCachingEnabled(true);
dataSource.setConnectionCacheProperties(cacheProperties);
OracleConnectionCacheManager.createCache(dataSource);
Connection connection = dataSource.getConnection();
connection.close();
Statement statement = connection.createStatement();
statement.addBatch("INSERT INTO table VALUES (1, 'abc')");
statement.addBatch("INSERT INTO table VALUES (2, 'def')");
statement.addBatch("INSERT INTO table VALUES (3, 'ghi')");
statement.executeBatch();
String sql = "SELECT * FROM table WHERE column = ?";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, "value");
ResultSet result = statement.executeQuery();
dataSource.setConnectionCachingEnabled(true);
dataSource.setConnectionCacheProperties(cacheProperties);
OracleConnectionCacheManager.createCache(dataSource);
sql
CREATE INDEX idx_column ON table (column);