Someone told me if I set the “ValidateConnection” property in Oracle to TRUE, the application will be able to handle the following cases:
- Timeouts on network equipment that shutdown TCP connections after a certain
amount of time and/or inactivity. - Physical connection breaks such as pulled cables, network equipment resets,
etc. - Oracle server being restarted, or DBA logically closing the connection on
the server side.
My questions are:
- If ValidateConnection is set to TRUE, can oracle actually handle the above cases?
- Do I need to write additional code or Oracle’s connection pool will just wait until the connection is timedout?
- What technique or tools can I use to test this cases? Sample code, or link to other article will be very useful.
Thanks.
ValidateConnection simply tells Oracle to test the connection from the pool prior to handing it to the application. This prevents you from getting already disconnected connections from the connection pool. To answer your question of which situations are handled by using ValidateConnection, I guess I would need to know what you mean by “handle”. If the Oracle server has been disconnected from the internet, ValidateConnection cannot do anything about it. However, once it is back online, ValidateConnection will prevent Oracle from handing your application disconnected connections from the connection pool. The link below gives some a little more information, and he shortly describes how he tested ValidateConnection in his environment.
http://spdeveloper.net/2009/10/disconnected-odp-net-and-system-data-oracleclient-connections/