在server.xml下
<GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> <Resource name="jdbc/webdb" auth="Container" type="javax.sql.DataSource" driverClassName="com.MySQL.jdbc.Driver" url = "jdbc:mysql://localhost:3306/数据库名字?charcterEncoding=utf-8" username = "root" passWord = "123456" maxActive="200" maxIdle="50" maxWait="3000" /> </GlobalNamingResources>apache-tomcat-7.0.73/conf/Catalina/localhost下建文件夹内容文件名称要与path的值相同
<Context path = "/webdemo" docBase = "webdemo" debug = "0"> <ResourceLink name = "jdbc/webdb" global = "jdbc/webdb" type="javax.sql.DataSource" /></Context>新闻热点
疑难解答