This article mainly describes the detailed analysis of problems related to tomcat (a very useful JSP running platform) and MySQL connection pool. After a day of research, I finally learned something about it, I hope it will be helpful to you. First, please note:
Here we will particularly discuss the problems encountered in tomcat (a very useful JSP running platform) Version 5.5. Why is this version especially special? I will explain it later.
Problem 1: Cannot create JDBC driver of class ''for connect URL 'null'
A:
[Cause Analysis]
Many friends are configuring $ tomcat (a very useful JSP running platform)/conf/server. xml (standardization is getting closer and closer), $ tomcat (a very useful JSP running platform)/conf/context. xml (standardization is getting closer and closer), and even WEB-INF/web. xml (standardization is getting closer and closer), and the above error occurs when MySQL connection pool is called.
The cause of the error is analyzed. This is generally because you do not specify a data source (the actual cause is that driverClassName and url are set to null, but you will certainly not forget to set this field, so it must have been set up and no connection is available !). Usually there are two ways to configure the Data source: $ tomcat (a good JSP running platform)/conf/context. xml (standardization is getting closer and closer)
One is to add the following code before $ tomcat (a good JSP running platform)/conf/server. xml (standardization is getting closer and closer) </GlobalNamingResources>:
Method 1:
- <Resource
- name="jdbc/test"
Data Source Name
- type="javax.sql.DataSource"
DriverClassName = "com. MySQL (the best combination with PHP). jdbc. Driver"
This is the driverClassName settings I just mentioned.
- password="admin"
Database Password
- maxIdle="2"
- maxWait="5000"
- username="root"
Database username
Url = "jdbc: MySQL (the best combination with PHP ):
- localhost:3306/test?autoReconnect=true"
Database URL, which is the url just mentioned
- maxActive="4"/>
In addition to comments, all parameters are set for the number of connections, idle status, and activity status. If you are only doing a learning test, you do not have to change it. This method is equivalent to configuring operations in the tomcat (a good JSP running platform) GUI.
The above content is a detailed description of Tomcat and MySQL connection pool issues, hoping to provide you with some help in this regard.