I want to specify the number of rows to prefetch for connection pool object using connection properties to override the default row prefetch size (10).
I have set the connection properties as mentioned below, but it is not reflecting while executing the query. Please check and let us know the solution.
Sample code snippet:
String dataSourceJndiName = "TestDataSource";
int oraPrefetchSize = 500;
try {
NamingContext ctx = new NamingContext();
DataSource dataSource =
(DataSource)ctx.getContext().lookup(dataSourceJndiName);
conn = ds.getConnection();
Properties props = new Properties();
props.put("oracle.jdbc.defaultRowPrefetch", oraPrefetchSize);
conn.setClientInfo(props);
} catch(Exception e) {
logger.error("Exception while getting connection object", e);
}
Please note that, I have verified in Toad by using "Database -> Monitor -> SGA Trace/Optimization" option to check whether defaultRowPrefetch property is working or not.
For example, I observed the below properties for executed query:
Rows Processed: 1200
Fetches: 121
Since I have set "oracle.jdbc.defaultRowPrefetch" as 500, the fetches should be 3.