Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I use jpa+hibernate+hikariCP. Today I got connection closed error. I setted connectionTimeout and ideleTimeout properties(hikari). If in meantime use does not do any operition hikari close the pool connections auto. So that I got closed connection problem. My question how can I set properly hiker(jpa,hibernate) properties so if user comes back after 3-4 hours and try to do some operation hikari auto reconnect to db? is it possible? I use hikari v2.6.1 and hibernate v5.2.8.Final

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
933 views
Welcome To Ask or Share your Answers For Others

1 Answer

This should already be working. Are you holding the connection open during this time? By default HikariCP closes and renews connections every 30 minutes (maxLifetime default). If your database has a shorter idle timeout than that, then you need to adjust the setting in HikariCP to match.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...