Changes between Version 1 and Version 2 of Ticket #136
- Timestamp:
- 02/18/2013 10:18:29 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #136 – Description
v1 v2 9 9 </database> 10 10 }}} 11 参数<prepared-statement-cache-size>8</prepared-statement-cache-size>即是启用preparestatment cache,默认是不启用的,即 这个值为0。11 参数<prepared-statement-cache-size>8</prepared-statement-cache-size>即是启用preparestatment cache,默认是不启用的,即值为0,去掉这行配置测试不会出现这个异常。 12 12 PreparedStatement是JDBC里面提供的对象,很多连接池都引入了PreparedStatementCache的概念。如Jboss连接池、C3P0,DBCP等。PreparedStatementCache即用于保存与数据库交互的prepareStatement对象。在cache里的ps对象,不需要重新走一次DBMS连接请求去创建。 13 13 PreparedStatementCache是跟着connection走的。一个connection就会有一个cache。比如一个cache允许缓存20条语句,20个connection就可能缓存400个。一般连接池可以支持这个的配置,能提高性能,但会占用较大内存,同时增加表字段时如果不重启应用会报异常:java.sql.SQLException: 违反协议,需要重启应用才能解决,所以一般不建议启用PreparedStatementCache。
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)