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

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -