简体   繁体   中英

disable persistent connections in mariadb for jdbc:mysql

Is there any way how to disable persistent jdbc:mysql connections to mariadb directly in tomcat/or mariadb server? I would like to do it similar way how I did it for php, where I disabled it in PHP (scripts in PHP won't fail, they'll just use non-persistent connections silently).

I have a java servlet which produces many connections which stay in sleep for very long time and causes "too many connection" issue.

As I am not java programmer, I am not able to change java servlet codes. (so I need to do it at higher level if possible)

  • Lower the wait_timeout .

  • Decrease the number of connections in your "connection pool", if you have one.

  • Decrease the number of "clients" in your web server is willing to spawn.

  • As a last resort, increase MySQL/MariaDB's max_connections .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM