The Java + JSP + tomcat6 + MySQL connection pool I recently saw on the Internet is mostly tomcat5. Many of them are not detailed and cannot be configured, which makes us very time-consuming and brainless, today, I finally successfully configured the connection pool of the latest atat6 + MySQL, And I will share the following:
1. required files:
Installation File)
2. ConfigureContext. xml file
Add a connection pool between <context> </context> as follows:
- <Resource Name = "JDBC/MySQL"
- Auth = "Container"
- Type = "javax. SQL. datasource"
- Driverclassname = "com. MySQL. JDBC. Driver"
- Url = "JDBC: mysql: // localhost/test"
- Username = "root"
- Password = "root"
- Maxactive = "100"
- Maxidle = "30"
- Maxwait = "10000" type = "codeph" text = "/codeph"/>
I don't need to talk about the above parameters. I know what it means.
3. Configure web. xml under your application
<Web-app> </Web-app>:
XML Code
- <Resource-ref>
- <Description> dB connection </description>
- <Res-ref-Name> JDBC/mysqlx </RES-ref-Name>
- <Res-type> javax. SQL. datasource </RES-type>
- <Res-auth> container </RES-auth>
- </Resource-ref>
4. Success
Do not use the original server. after the configuration is in XML, you can write the test program below. There will be a lot on the internet, mainly on the top. Of course, you need to put the connection drivers under the Lib under Tomcat 6.
Gengv: verified and successful.