加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

行使Oracle JDBC驱动措施隐式缓存成果

发布时间:2021-01-22 02:34:44 所属栏目:站长百科 来源:网络整理
导读:我很确定其他人已经问过这个题目,但我如故找不到满足的谜底. ??以是,这是我的场景:我想行使Oracle的JDBC驱动措施隐式语句缓存(此处记录: http://docs.oracle.com/cd/B28359_01/java.111/b31224/stmtcach.htm#i1072607) 我必要行使来自第三方JDBC池提供措施

我很确定其他人已经问过这个题目,但我如故找不到满足的谜底.
??以是,这是我的场景:我想行使Oracle的JDBC驱动措施隐式语句缓存(此处记录: http://docs.oracle.com/cd/B28359_01/java.111/b31224/stmtcach.htm#i1072607)

我必要行使来自第三方JDBC池提供措施的毗连(更详细地说,Tomcat JDBC),我别无选择.

题目是启用隐式缓存的要领是两步进程(响应于文档):

1.

Call setImplicitCachingEnabled(true) on the connection
or
Call OracleDataSource.getConnection with the ImplicitCachingEnabled
property set to true. You set ImplicitCachingEnabled by calling
OracleDataSource.setImplicitCachingEnabled(true)

2.

In addition to calling one of these methods,you also need to call
OracleConnection.setStatementCacheSize on the physical connection. The
argument you supply is the maximum number of statements in the cache.
An argument of 0 specifies no caching.

我可以忍受1(不知怎的,我可以设置我的池行使OracleDataSource作为主毗连工场,而且我可以配置OracleDataSource.setImplicitCachingEnabled(true)).
可是在第二步,我已经必要毗连才气挪用setStatementCacheSize.

我的题目是,是否有也许在数据源级别指定statementCacheSize的默认值,以便我可以从已启用隐式缓存的OracleDataSource毗连中获取.

PS:喂授这里找到的一些相干题目:
Oracle jdbc driver: implicit statement cache or setPoolable(true)?

更新(也许的办理方案):

最终我这样做了:

>行使oracle.jdbc.pool.OracleDataSource建设本机毗连池.
>行使行使本机的org.apache.tomcat.jdbc.pool.DataSource建设了一个tomcat JDBC毗连池(请参阅属性dataSource).
>通过AOP启用poincut,以便执行’execution(public java.sql.Connection oracle.jdbc.pool.OracleDataSource.getConnection())’后,我拾取工具并执行我想要的配置.

办理方案结果很好;我只是不兴奋我不得不写一些样板来做它(我等候一个直接的属性).

办理要领

白皮书 Oracle JDBC Memory Management说

The 11.2 drivers also add a new property to enable the Implicit Statement Cache.

oracle.jdbc.implicitStatementCacheSize

The value of the property is an
integer string,e.g. “100”. It is the initial size of the statement
cache. Setting the property to a positive value enables the Implicit
Statement Cache. The default is “0”. The property can be set as a System property via -D or as a connection property via getConnection.

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读