I have a java application which I have implemented its’ database connection using singleton pattern. I only close the database connection when the main application is closed. Is it a good practice to keeping a database connection open like this? or what sort of problems might be occur?
I have a java application which I have implemented its’ database connection using singleton
Share
Mysql Server usually closes the connection after a period of time(maybe default 8 hours, I’m not sure) and you must check whether the your connection is active. If the connection is closed, you must reconnect the sever.