One Server.xml of Tomcat and MySQL

xiaoxiao2021-03-06  40

$ Catalina_home / conf / server.xml

Debug = "5" reloadable = "true" crossContext = "true">

prefix = "localhost_dbtest_log." suffix = ". txt"

TimeStamp = "true" />

Auth = "container"

TYPE = "javax.sql.datasource" />

factory

org.apache.commons.dbcp.basicDataSourceFactory

Configure your mysqld max_connections large enough to handle

All of Your DB Connections. Set to 0 for no limit.

->

maxactive

100

Set to -1 for no limit. See Also The DBCP Documentation on this

And The MinevictableIdletimeMillis Configuration Parameter.

->

maxidle

30

IN ms, in this example 10 seconds. An Exception Is Thrown IF

THIS TIMEOUT IS EXCEEDED. SET to -1 to wait indefinitely.

->

maxwait

10000

Username

javauser

Password

javadude

If you want to use tris driver - We Recommend Using Connector / J Though

driverclassname

Org.gjt.mm.mysql.driver

->

driverclassname

com.mysql.jdbc.driver

The autoreconnect = true argument to the url makess sure what the the URL MAKES SURE THAT

MM.MYSQL JDBC Driver Will Automatically Reconnect IF MySQLD CLOSED THE

Connection. mysqld by Default Closes iDle Connections After 8 Hours.

->

URL

jdbc: mysql: // localhost: 3306 / javatest? AutoreConnect = true

Configuration of the application Web-INF / Web.xml

XMLns: xsi = "http://www.w3.org/2001/xmlschema-instance"

XSI: SchemAlocation = "http://java.sun.com/xml/ns/j2ee

Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "

Version = "2.4">

MySQL Test App

DB Connection

JDBC / TESTDB

javax.sql.datasource Container

转载请注明原文地址:https://www.9cbs.com/read-79635.html

New Post(0)