사용자 도구

사이트 도구


java:database:bonecp

문서의 이전 판입니다!


BoneCP

설정 예(Spring)

<bean class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
   <property name="driverClass" value="#{driverClass}" />
   <property name="jdbcUrl" value="#{jdbcUrl}" />
   <property name="username" value="#{username}"/>
   <property name="password" value="#{password}"/>
   <property name=idleConnectionTestPeriodInSeconds value="60"/>
   <property name="idleMaxAgeInSeconds" value="240"/>
   <property name="maxConnectionsPerPartition" value="#{maxConnectionsPerPartition}"/>
   <property name="minConnectionsPerPartition" value="#{minConnectionsPerPartition}"/>
   <property name="partitionCount" value="2"/>
   <property name="acquireIncrement" value="5"/>
   <property name="statementsCacheSize" value="100"/>
   <property name="releaseHelperThreads" value="3"/>
   <property name="connectionTimeoutInMs" value="10000"/>
   <property name="connectionTestStatement" value="/* ping */ select 1" />
</bean>

0.8.RELEASE

WARN ConnectionPartition.finalizeReferent - BoneCP detected an unclosed connection (in pool 'pool name') and will now attempt to close it for you. You should be closing this connection in your application - enable connectionWatch for additional debugging assistance or set disableConnectionTracking to true to disable this feature entirely.

# 위 WARNING이 발생하면서 MySQL 사용시에 다음과 같은 오류가 연쇄 발생
....
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
  • 현재 테스트 해보는중
    // Spring 등을 통해 connection release가 100% 보장되는 경우 다음처럼 커넥션 트랙킹을 disable.
    boneCpDataSource.setDisableConnectionTracking(true);
    
    // 다른곳에서의 해결책 : https://groups.google.com/forum/#!topic/play-framework/eshzvWuNQcc
    boneCpDataSource.setStatisticsEnabled(true);
    boneCpDataSource.setReleaseHelperThreads(2); // 이 값을 2로하면 문제가 사라진다 함.
java/database/bonecp.1403686927.txt.gz · 마지막으로 수정됨: 2014/06/25 18:02 저자 kwon37xi