MySQL connection pool problems and Tomcat Solutions

Source: Internet
Author: User
Tags mysql connection pool

In our previous articles, we have explained the first method for the problem of Tomcat and MySQL connection pools, today, we will mainly talk about the problem of Tomcat and MySQL connection pools. Another method is in $ tomcat/conf/server. <Context...> </Context> Add the following code:

Setting method:

 
 
  1. <Resource name = "jdbc/test" auth = "Container" type = "javax. SQL. DataSource"/>
  2. <ResourceParams name = "jdbc/test">
  3. <Parameter>
  4. <Name> factory </name>
  5. <Value> org. apache (the most popular WEB server platform on the Unix platform). commons. dbcp. BasicDataSourceFactory </value>
  6. </Parameter>
  7. <Parameter>
  8. <Name> username </name>
  9. <Value> root </value>
  10. </Parameter>
  11. <Parameter>
  12. <Name> password </name>
  13. <Value> admin </value>
  14. </Parameter>
  15. <Parameter>
  16. <Name> driverClassName </name>
  17. <Value> com. MySQL (the best combination with PHP). jdbc. Driver </value>
  18. </Parameter>
  19. <Parameter>
  20. <Name> url </name>
  21. <Value> jdbc: MySQL (the best combination with PHP): // localhost: 3306/test? AutoReconnect = true </value>
  22. </Parameter>
  23. <Parameter>
  24. <Name> initialSize </name>
  25. <Value> 20 </value>
  26. </Parameter>
  27. <Parameter>
  28. <Name> maxActive </name>
  29. <Value> 30 </value>
  30. </Parameter>
  31. <Parameter>
  32. <Name> maxWait </name>
  33. <Value> 10000 </value>
  34. </Parameter>
  35. </ResourceParams>

The general purpose of this setting is to make the data source be implemented in a separate ing directory, that is, the Code usually appears in the <Context docBase = "specific directory (such as D: \ webapps \ myjsp (preferred for SUN Enterprise Applications) "path =" Access name (e.g./myjsp (preferred for SUN Enterprise Applications )) "reloadable =" true "> </Context> to access http: // localhost: 8080/myjsp (preferred for SUN Enterprise Applications)/XXX. jsp (preferred for SUN Enterprise applications) to access a jsp in D: \ webapps \ myjsp (preferred for SUN Enterprise Applications) (preferred for SUN Enterprise applications) page to retrieve the data source or perform other operations to retrieve the data source.

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.