java - tomcat 7 how to keep jdbc connection alive for ever -


i have war requires permanent jdbc connection.

i've tried (context.xml)

maxactive="100"  maxidle="3"  maxwait="1000"   minidle="1" 

but connection still dies after while. how can keep jdbc connection alive 24/7?

thanks

first of all: you cannot keep alive forever

at point fail / break. network interruption, maintenance of either software or database or else.

so "i want one connection can use whenever need, never close automatically" not happen you.

instead using connection pool, can have: "i want able valid , working database connection @ point in time" quite easy in comparison.

most connection pools (hikaricp, c3p0, tomcat database pool, ...) support configuration options guarantee (that is: if database , network connection works) can valid connection when need it.


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -