org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:514).....
把數據源換成c3p0也不行,求大神!!
Could not open Hibernate Session for transaction;
應該是數據庫連接未設置自動重連的屬性或者是數據庫的jdbc驅動不能支持重連
你檢查下你的連接池屬性配置
mysql的重連autoReconnect參數不能使連接重連
c3p0連接池支持重連;重連參數是:
idleConnectionTestPeriod 設置空閒連接測試周期
preferredTestQuery : 設置一查詢語句,用於重連測試
testConnectionOnCheckin設置為true
testConnectionOnCheckout設置為true
testConnectionOnCheckout設置為true