mysql| Data | database
1 Download the Mm.mysql-2.0.14-bin.jar package and put it in the Common/lib folder under the Tomcat directory
2 in the Tomcat directory in the Conf/server.xml in the </Host> before the join (note: All uppercase places to replace your own things)
<!--for MySQL database connection pool--><context path= "/application_name" docbase= "Applicatioin_name" debug = "5" reloadable= "true" crosscontext= "true" > <logger classname= "Org.apache.catalina.logger.FileLogger" Prefix= "Localhost_dbtest_log." suffix= ". txt" timestamp= "true"/> <resource name= "Jdbc/database_name" auth= "Container" type= "Javax.sql.DataSource"/> <resourceparams name= "Jdbc/database_name" > < parameter> <name>factory</ name> <value> org.apache.commons.dbcp.basicdatasourcefactory</value> </parameter> <!--Class name for mm.mysql JDBC driver- -> <parameter> <name>driverClassName</name> <value>org.gjt.mm.mysql.Driver</value> </ Parameter> <!--the JDBC Connection URL for connecting to your MySQL db. the Autoreconnect=true argument to The URL makes sure that the mm.mysql JDBC Driver'll automatically reconnect if mysqld closed & nbsp; the connection. mysqld By default closes idle connections after 8 hours.--> nbsp; <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/database_ name?autoreconnect=true</value> </parameter> <!--MySQL db username and password for db connections --> & nbsp; <parameter> <name>username</ name> <value>DB_ username</value> </parameter> <parameter> <name>password</name> <value>DB_PASSWORD</value> </parameter> <!--Maximum number of DB connections in pool. Make sure Configure your mysqld max_connections large enough to handle & nbsp; All of your DB connections. Set to 0 for no limit.--> <parameter> &nbsP <name>maxactive</name > <value> 100</value> </parameter> <!--Maximum number of idle DB connections to retain in pool. Set to 0 for no limit. --> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <!--Maximum A DB connection to become available in ms,   ; in this example seconds. An Exception are thrown if this timeout is exceeded. Set to-1 to wait indefinitely.--> & nbsp; <parameter> <name>maxWait</name> <value>10000 </value> </parameter> </resourceparams ></Context> so even if the connection is over
3) Test:
Database_name:testdb
Application_name:mysqltest
Create a new table in the TestDB database userinfo
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.