The first installation is actually successful, written out for your reference.
Tomcat itself provides a good use of Web management tools. Let's use it to complete our work. First Open Tomcat / conf / Tomcat-users.xml Add the following code
Where CONTEXT is to establish a site. DocBase indicates that the site where the site is located, the access path Workdir represents the working directory, because JSP is compiled into a Class file in the first runtime, and these compiler have existed .Resource It is to configure the connection pool ... JDBC: mysql: //192.168.0.249: 3306 / TEST IP address represents the IP of the database, 3306 is the default port of MySQL, Test is the database to connect. He added a sentence. To connect Mysql After installation MySQL, download MySQL's JDBC driver, you can get in MySQL's official website. ISERNAME Password nature is a username and password indicating the connection database. Enter the com.mysql.jdbc in .driverclassname according to the actual situation. JDBC2.OPTIONAL.MYSQLCONNECTIONPOOLDATASOURCE This string can be found in the JDBC driver. Maxactive indicates that the maximum number MaxIdle indicating the connection pool indicates the number of air closures of the connection pool (this is not clear, what does it mean, I know, I will reply me. Thank you) MaxWait indicates the time of the connection (-1 means waiting for it), and now you need to write a program to test it.
Built an index.jsp in your virtual site directory, the program content is as follows: <% @ Page ContentType = "text / html; charset = GBK"%> <% @ page import = "javax.naming. *, Java.sql *, javax.sql. * "%> <%
Context initcontext (); context envcontext = (context) INITCONTEXT.LOOKUP ("Java: / Comp / ENV");
DataSource DS = (DataSource) ENVCONTEXT.LOOKUP ("Eway365_Mysql"); // Here is the name connection conn = ds.getConnection (); out.println ("Connection pool configuration is successful!"); Conn.close () Out.println ("successfully connected!
Ok, I don't have any problems, I'm doing it ..........