整合SSH2框架之—init.properties 檔案的寫法
當我們需要進行SSH2整合時,可以將資料庫連線的關鍵資訊寫入init.properties檔案中:
下面給出一個樣例檔案的內容,可以參考:
datasource.type=mysql
datasource.driverClassName=com.mysql.jdbc.Driver
datasource.url=jdbc\:mysql\://database_server_ip_address/
database_name
datasource.username= username
datasource.password= password
# max active user
datasource.maxActive=10
# max idle user
datasource.maxIdle=2
# max wait time for long connection, unit is ms, 120000 ms = 120 s = 2 minute
datasource.maxWait=120000
datasource.whenExhaustedAction=1
datasource.testOnBorrow=true
datasource.testOnReturn=false
c3p0.acquireIncrement=3
c3p0.initialPoolSize=3
c3p0.idleConnectionTestPeriod=900
c3p0.minPoolSize=2
c3p0.maxPoolSize=50
c3p0.maxStatements=100
c3p0.numHelperThreads=10
c3p0.maxIdleTime=600
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.jdbc.batch_size=25
hibernate.jdbc.fetch_size=50
hibernate.show_sql=true
hibernate.connection.release_mode=after_transaction