To solve StaleConnection issue in datasource configured at WAS level please do the following:
• Enable pre-test SQL string for that data source
• Place SQL string as “SELECT 1 FROM SYSIBM.SYSDUMMY1” for DB2 and “SELECT 1 FROM DUAL” for Oracle
The above said properties will be present in Connection pool properties in WAS – Admin Console .
NOTE: This will be valid and holds GOOD ONLY if the datasource is ConnectionPoolDataSource implementation .