默认行预取属性不适用于连接对象

时间:2018-02-14 07:33:55

标签: java jdbc connection-pool

我想使用连接属性指定要为连接池对象预取的行数,以覆盖默认的行预取​​大小(10)。

我已经设置了如下所述的连接属性,但在执行查询时没有反映出来。请检查并告诉我们解决方案。

示例代码段:

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); 
} 

请注意,我已使用"数据库 - >在Toad中进行了验证。监控 - > SGA跟踪/优化"检查defaultRowPrefetch属性是否正常的选项。

例如,我观察了执行查询的以下属性:

Rows Processed: 1200 
Fetches:         121 

因为我已经设置了" oracle.jdbc.defaultRowPrefetch"如500,提取应为3.

0 个答案:

没有答案