I have a war that requires a permanent jdbc connection.
I've tried this (context.xml)
maxActive="100"
maxIdle="3"
maxWait="1000"
minIdle="1"
But the connection still dies after a while. How can i keep a jdbc connection alive 24/7?
thanks
I have a war that requires a permanent jdbc connection.
I've tried this (context.xml)
maxActive="100"
maxIdle="3"
maxWait="1000"
minIdle="1"
But the connection still dies after a while. How can i keep a jdbc connection alive 24/7?
thanks
First of all: you cannot keep it alive forever
At some point something will fail / break. Be it some network interruption, some maintenance of either your software or the database or something else.
So "I want one connection that I can use whenever I need, so it will never close automatically" is not likely to happen for you.
Instead by using a connection pool, you can have: "I want to be able to get a valid and working database connection at any point in time" is quite easy to get in comparison.
Most good connection pools (hikariCP, c3p0, tomcat database pool, ...) support configuration options that guarantee (that is: if the database is up and the network connection works) you can get a valid connection when you need it.