This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've just changed the DBCP configuration and after I wait a day, I didnt get the issue I previously had. Once in 30 minutes it checks for max 3 connections if it is still valid. If no, it will be removed from the pool which solves the stale connection problem. Below a part of this testOnBorrow config: