Knowledge Base
The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides

|
When using OracleDataSource in Spring Framework, the application reports an SQLException with the error: Invalid or Stale Connection found (2013965)
Symptoms
- When using the SpringSource Advanced Pack for Oracle, Spring Data's JDBC Extensions for Oracle, or OracleDataSource in your Spring configuration, the application reports an SQLException
- You see the error:
Invalid or Stale Connection found
Cause
- When a connection is manually disconnected from the database, probably by an administrator.
- When a connection exists in the connection pool without being used for an extended period of time and is disconnected due to a timeout.
- When the database is restarted, probably for maintenance purposes.
- A network event has caused the connection to drop, probably because the network has become unavailable or a firewall has dropped a connection which has been open for too long.
Resolution
- Set the ValidateConnection connection cache property to true. This forces the pool to validate a connection before it is given to your application. Any invalid or stale connections are dropped and replaced by new valid connections.
Example: Using orcl schema of Spring AP for Oracle and Spring Data JDBC Extensions
<orcl:pooling-datasource id="dataSource" properties-location="classpath:orcl.properties">
<orcl:connection-cache-properties>
ValidateConnection=true
</orcl:connection-cache-properties>
</orcl:pooling-datasource>
- If the connection is dropped due to a timeout, set the InactivityTimeout property that configures the time period (in seconds) within which a connection exists in the cache unused. When a connection exceeds this value, it is automatically closed.
Example: Using orcl schema of Spring AP for Oracle and Spring Data JDBC Extensions
<orcl:pooling-datasource id="dataSource" properties-location="classpath:orcl.properties">
<orcl:connection-cache-properties>
InactivityTimeout=60
</orcl:connection-cache-properties>
</orcl:pooling-datasource>
Additional Information
For more information, see Connection Cache Properties.
Note: The preceding link was correct as of June 06, 2012. If you find the link is broken, provide feedback and a VMware employee will update the link.
Request a Product Feature
To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.
Actions
KB:
- Updated:
- Categories:
- Languages:
- Product Family:
- Product(s):
- Product Version(s):

