$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 this 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 makes sure that the
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
该应用的配置web-inf/web.xmlxmlns: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