Document
1. Start the Tomcat server, open the browser, and enter http: // localhost: 8080/admin/(localhost is the name server or host) to go To the login page of the management interface, in this case, enter the user name and password required during the original installation and log on to the management interface.
2. Select Resources-Data sources to go to the Data source configuration page. Select
Data Source Actions-> select Create New Data Source to go to the configuration details page.
3. modify \ conf \ context. xml with the following content:
Reference content is as follows: <Context> <Resource name = "jdbc/mysql" Auth = "Container" Type = "javax. SQL. DataSource" DriverClassName = "org. gjt. mm. mysql. Driver" Url = "jdbc: mysql: // 192.168.1.89/DB" Username = "root" Password = "19830918" MaxActive = "4" MaxIdle = "2" MaxWait = "500" type = "codeph" text = "/codeph"/> </Context> |
4. modify web. xml
Open % atat_home % \ conf \ web. xml and add the following content before it:
Reference content is as follows: <Resource-ref> <Description> DB Connection </description> <Res-ref-name> jdbc/mysql </res-ref-name> <Res-type> javax. SQL. DataSource </res-type> <Res-auth> Container </res-auth> </Resource-ref> |
Note that the res-ref-name must be the same as the JNDI Name mentioned above. Now, the configuration is complete!
5. Use "java: comp/env/jdbc/mysql" to reference JNDI ";
You can directly apply the JNDI name, such as weblogic8. TOMCAT does this.
Vi. JDBC driver mysql-connector-java- 5.0.0 Beta-bin.jar
Be sure to place it under % atat_home % \ common \ lib.
Restart your Tomcat service.