Tomcat JNDI connection pool

xiaoxiao2021-03-13  183

I. Put the JDBC driver under Tomcat_Home / Common / LIB, one more, if you use SQL Server, there are at least two drivers to choose, one is Microsoft provided, the other is JTDS, better than Microsoft. A lot, recommended

II. Profile, Tomcat different version of the configuration file is slightly different, below Tomcat5..5. * As an example.

III. If the configuration is incorrect, javax.naming.namenotFoundException: Name is Not Bound In this context error mode 1. Global database connection pool 1, configure the connection pool through the management interface, or direct GlobalNamingResources in Tomcat / conf / server.xml increase 2, in Tomcat / WebApps / MyApp / Meta-INF / Context. Add: is OK.

Second, the global database connection pool 1, the same top 2, add: Way III, local database connection pool Add: Parameter Description: DriveClassName: The complete name of the JDBC driver class; maxactive: maximum number of available instances that can be assigned from the connection pool; maxidle: can be idle at the same time The maximum number of connections in the pool; maxwait: maximum timeout, in milliseconds; Password: user password; URL: to JDBC URL connection; user: User name; validationQuery: Used to query the idle connection in the pool. The above three ways can be in Tomcat 5.5.4. In addition, SQL Server's JDBC Driver is SQL Server JDBC (SP3) downloaded from the Microsoft website. Examples of Tomcat 5.0 and Tomcat 5.5 configuration files respectively (place this configuration file) under Tomcat / Conf / Catalina / Localhost)

Tomcat5.0

factory org .apache.commons.dbcp.BasicDataSourceFactory <-! Maximum number of dB connections in pool Make sure you configure your mysqld max_connections large enough to handle all of your db connections Set to 0 for no.. Limit. -> maxactive 100 maxidle 30 maxwait 10000 username sa password test <

! - Class Name for JDBC Driver -> driverclassname net.sourceforge.jtds.jdbc.driver defaultautocommit true URL jdbc: jtds: sqlserver: // url / filedb; charSet = GB2312; Autoreconnect = true < Parameter> Removeabando Ned true RemoveAbandONEDTimeout 60 logabandoned

True Tomcat 5.5

It can be seen that the 5.0 plasma is an element to become attribute in 5.5.

转载请注明原文地址:https://www.9cbs.com/read-129145.html

New Post(0)