wait_timeout = 28800 秒(8 小時)CannotGetJdbcConnectionException| 策略 | DBCP 參數 | C3P0 參數 | 優缺點 |
|---|---|---|---|
| 借用時驗證 | testOnBorrow=true (預設) | testConnectionOnCheckout=true | ✅ 安全,❌ 高併發下額外 RTT 影響效能 |
| 歸還時驗證 | testOnReturn=true | testConnectionOnCheckin=true | 同借用時 |
| 空閒驗證(推薦) | testWhileIdle=truetimeBetweenEvictionRunsMillis < 8h | idleConnectionTestPeriod < 8h | ✅ 後台異步清理,✅ 無業務線程阻塞,⚠️ 需小於 wait_timeout |