As far as I know, the check-valid-connection-sql will do the trick for you. I verified this on both mysql and informix server.
I believe your problem lies in spring beans which is cached and hence has no chance to get the newly created connection from JBoss.
I would suggest that you change your datasource bean to "prototype" to try and verify my guess.
Also you need to config ALL the beans which refer to datasource bean to be "prototype".
BTW, configurating the datasource to be a "prototype" bean is not best practice.
If you verified that my guess turn out to be true, you need to find sulotion from spring side and not JBoss side.
Connection.isValid() isn't implemented in jtds.
I'm not using jboss, but I found even catching any SQLException and forcing a complete restart of the connection didn't work.
You can try to disable caching of your JNDI datasource in Spring like this:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="cache" value="false" />
<property name="proxyInterface" value="javax.sql.DataSource" />
Here is a quote from JndiObjectFactoryBean:
* Set whether to cache the JNDI object once it has been located.
* Default is "true".
* <p>Can be turned off to allow for hot redeployment of JNDI objects.
* In this case, the JNDI object will be fetched for each invocation.
* <p>For hot redeployment, a proxy interface needs to be specified.
* @see #setProxyInterface
* @see #setLookupOnStartup