One quick fix is to set the validationQuery property in your JNDI
configuration to some fast query that returns at least one row, for
example "SELECT 1" or "SELECT DUMMY FROM DUAL". This will allow DBCP to
validate the query before returning it your client code.
You may also find the comments at
<http://issues.apache.org/bugzilla/long_list.cgi?buglist=14592>
helpful.
If you need more detail, please follow up.