榪欐槸涓涓嬌鐢–3P0鐨刪ibernate.properties鏍蜂緥鏂囦歡錛堟潵鑷狧ibernate鍖呬腑etc鐩綍涓嬶級錛?/p>
###########################
### C3P0 Connection Pool###
###########################
#hibernate.c3p0.max_size 2
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false
鍦╤ibernate.cfg.xml鏂囦歡閲岄潰鍔犲叆濡備笅鐨勯厤緗細(xì)
<!-- 鏈澶ц繛鎺ユ暟 -->
<property name="hibernate.c3p0.max_size">20</property>
<!-- 鏈灝忚繛鎺ユ暟 -->
<property name="hibernate.c3p0.min_size">5</property>
<!-- 鑾峰緱榪炴帴鐨勮秴鏃舵椂闂?濡傛灉瓚呰繃榪欎釜鏃墮棿,浼?xì)鎶涘嚭寮傚父锛屽崟浣嶆绉?***-->
<property name="hibernate.c3p0.timeout">120</property>
<!-- 鏈澶х殑PreparedStatement鐨勬暟閲?-->
<property name="hibernate.c3p0.max_statements">100</property>
<!-- 姣忛殧120縐掓鏌ヨ繛鎺ユ睜閲岀殑絀洪棽榪炴帴 錛屽崟浣嶆槸縐?->
<property name="hibernate.c3p0.idle_test_period">120</property>
<!-- 褰撹繛鎺ユ睜閲岄潰鐨勮繛鎺ョ敤瀹岀殑鏃跺欙紝C3P0涓涓嬭幏鍙栫殑鏂扮殑榪炴帴鏁?-->
<property name="hibernate.c3p0.acquire_increment">2</property>
<!-- 姣忔閮介獙璇佽繛鎺ユ槸鍚﹀彲鐢?-->
<property name="hibernate.c3p0.validate">true</property>
瀹屾暣紺轟緥濡備笅錛坔ibernate.properties錛夛細(xì)
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost/mydatabase
hibernate.connection.username = myuser
hibernate.connection.password = secret
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect