This content has been marked as final. Show 3 replies
this usually happens in 2 scenarios
1. if the applicaiton using too many concurrent connections and the applicaiton is really busy with DB connecitons, then you have to increase the max capacicty.
2. The conneciton leak, verify the code and make the connecitons are released properly.
In most occations, the scenario-2 would be the cause.
The first condition is not applicable to my scenario, we do not have much concurrent users. Also even after incresing the max capacity, it occurs but at a later stage.
Also I have checked the code thoroughly once again, but there is no connection leak.
Yesterday I found out about datasource property "Inactive connection timeout", after I made this value to 60(seconds) and tested the application continuosly, it didnt fail, it worked. Non zero value of this property means, datasource will reclaim the connection from the application after the set value of seconds.It is a good idea to use this property in production, kindly let me know.
That confirms the conneciton leak situation. We should use the "Inactive Connection Timeout" settings only to reclaim the leaked connections i.e the connections that were not explicitly closed by the application. By Default, this parameter is set to 0 and that means this feature is disabled. This is recommended setting.
This setting should not be used in place of properly closing connections. Since your applicaiton is not closing the connections explicitly, this settings is coming into picture and it works for you now.
Ideally, you should set the value as '0' but ofcourse you can use this setting as workaround if its produciton. The permanent fix to review your code again and make sure the connections are properly closed.