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 name> org .apache.commons.dbcp.BasicDataSourceFactory value> parameter> <-! 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 name> 100 value> parameter> maxidle name> 30 value> parameter> maxwait name> 10000 value> parameter> username name> sa value> parameter> password name> test value> parameter> <
! - Class Name for JDBC Driver -> driverclassname name> net.sourceforge.jtds.jdbc.driver value> parameter> defaultautocommit name> true value> parameter> URL name> jdbc: jtds: sqlserver: // url / filedb; charSet = GB2312; Autoreconnect = true value> parameter> < Parameter> Removeabando Ned name> true value> parameter> RemoveAbandONEDTimeout Name> 60 value> parameter> logabandoned name>
True value> parameter> resourceparams> Tomcat 5.5
It can be seen that the 5.0 plasma is an element to become attribute in 5.5.