Tomcat connection pool configuration (MySQL)

Source: Internet
Author: User

 

The configuration in Tomcat, which was previously used, can be found:

  1. <! -- For MySQL database connection pool -->
  2. <Context Path = "/tomcattest" docbase = "D:/Eclipse/workspace/tomcattest" workdir = "D: /Eclipse/workspace/tomcattest/work/org/Apache/jsp "DEBUG =" 5 "reloadable =" true "crosscontext =" true ">
  3. <Logger classname = "org. Apache. Catalina. Logger. filelogger" prefix = "localhost_dbtest_log." suffix = ". txt" timestamp = "true"/>
  4. <Resource Name = "JDBC/test" auth = "Container" type = "javax. SQL. datasource"/>
  5. <Resourceparams name = "JDBC/test">
  6. <Parameter>
  7. <Name> factory </Name>
  8. <Value> org. Apache. commons. DBCP. basicperformancefactory </value>
  9. </Parameter>
  10. <! -- Class name for mm. MySQL JDBC driver -->
  11. <Parameter>
  12. <Name> driverclassname </Name>
  13. <Value> org. gjt. Mm. MySQL. Driver </value>
  14. </Parameter>
  15. <! -- The JDBC connection URL for connecting to your MySQL db.
  16. The autoreconnect = true argument to the URL makes sure that
  17. Mm. MySQL JDBC driver will automatically reconnect if mysqld closed
  18. The connection. mysqld by default closes idle connections after 8 hours. -->
  19. <Parameter>
  20. <Name> URL </Name>
  21. <Value> JDBC: mysql: // localhost: 3306/test? Autoreconnect = true </value>
  22. </Parameter>
  23. <! -- MySQL db username and password for DB connections -->
  24. <Parameter>
  25. <Name> username </Name>
  26. <Value> root </value>
  27. </Parameter>
  28. <Parameter>
  29. <Name> password </Name>
  30. <Value> admin </value>
  31. </Parameter>
  32. <! -- Maximum number of DB connections in pool. Make sure you
  33. Configure your mysqld max_connections large enough to handle
  34. All of your DB connections. set to 0 for no limit. -->
  35. <Parameter>
  36. <Name> maxactive </Name>
  37. <Value> 100 </value>
  38. </Parameter>
  39. <! -- Maximum number of idle dB connections to retain in pool.
  40. Set to 0 for no limit. -->
  41. <Parameter>
  42. <Name> maxidle </Name>
  43. <Value> 30 </value>
  44. </Parameter>
  45. <! -- Maximum time to wait for a DB connection to become available in MS,
  46. In this example 10 seconds. An exception is thrown if this timeout
  47. Is exceeded. Set to-1 to wait indefinitely. -->
  48. <Parameter>
  49. <Name> maxwait </Name>
  50. <Value> 10000 </value>
  51. </Parameter>
  52. </Resourceparams>
  53. </Context>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.