Break through the JNDI connection pool (configure the connection pool through the Management Interface in Tomcat5.5)

Source: Internet
Author: User

Break the JNDI connection pool --

After several days of hard work, I can finally connect to the connection pool. I have referred to many of my posts on this topic. Now I have written several issues that have occurred over the past few days here:
I. in tomcat (a very useful JSP running platform) _ homecommon, put the jdbc three drivers (must be), you can download them on Microsoft's website, the Default User Name for installing SQLSERVER2k is sa, and the password is blank. However, if the password is empty, it does not mean that there is no password. Therefore, you must define username and password in your url. It is best to reset the password.
II. if the error cannot be referenced, the path is not correctly written. tomcat (a very useful JSP running platform) is the default path tomcat (a very useful JSP running platform) _ homewebapps but use 5.5.x, follow the following method on the line, do not need to configure the path, and do not need to be in the youwebappWEB-INFweb.xml (standardization is getting closer and closer) file configuration reference
III. tomcat (a very useful JSP running platform) 5.5.x server. xml (standardization is getting closer and closer) configuration is different from tomcat (a very useful JSP running platform) 5.0 configuration. The following lists three types of configuration in tomcat (a very useful JSP running platform) 5.5.x configuration method. If the configuration is incorrect, javax will appear. naming. nameNotFoundException: Name is not bound in this Context Error
Method 1: Global Database Connection Pool
1. Configure the connection pool through the management interface, or directly add it to GlobalNamingResources of confserver. xml (standardization is getting closer and closer) in tomcat (a very useful JSP running platform ).
<Resource name = "jdbc/mydb" type = "javax. SQL. dataSource "password =" mypwd "driverClassName =" com. microsoft. jdbc. sqlserver. SQLServerDriver "maxIdle =" 2 "maxWait =" 5000 "validationQuery =" select 1 "username =" sa "url =" jdbc: microsoft: sqlserver: // localhost: 1433; databaseName = mydb "maxActive =" 4 "/>
2, in tomcat (a very useful JSP operating platform) webappsmyappMETA-INFcontext.xml (standardization is getting closer and closer) added in Context:
<ResourceLink global = "jdbc/mydb" name = "jdbc/mydb" type = "javax. SQL. DataSource"/>
In this way, you can.
Method 2: Global Database Connection Pool
1. Same as above
2. added in the Context of confcontext. xml (standardization is getting closer and closer) of tomcat (a very useful JSP running platform:
<ResourceLink global = "jdbc/mydb" name = "jdbc/mydb" type = "javax. SQL. DataSource"/>
Method 3: Local Database Connection Pool
Just add in the Context of tomcat (a good JSP running platform) webappsmyappsMETA-INFcontext.xml (standardization is getting closer and closer:
<Resource name = "jdbc/mydb" type = "javax. SQL. dataSource "password =" mypwd "driverClassName =" com. microsoft. jdbc. sqlserver. SQLServerDriver "maxIdle =" 2 "maxWait =" 5000 "validationQuery =" select 1 "username =" sa "url =" jdbc: microsoft: sqlserver: // localhost: 1433; databaseName = mydb "maxActive =" 4 "/>
Parameter description:
DriveClassName: full name of the JDBC Driver Class;
MaxActive: Maximum number of available instances that can be allocated from the connection pool;
MaxIdle: Maximum number of connections that can be idle in the connection pool at the same time;
MaxWait: Maximum timeout in milliseconds;
Password: user password;
Url: URL Connection to JDBC;
User: user name;
ValidationQuery: Used to query idle connections in the pool.
The above three methods can be used in tomcat (a good JSP running platform) 5.5.4. In addition, the jdbc driver of SQL server (a powerful database platform on WINDOWS) is the SQL server (a powerful database platform on WINDOWS) jdbc (sp3) downloaded from the Microsoft website ).
4. org. apache (the most popular WEB server platform on Unix ). tomcat (a very useful JSP running platform ). dbcp. dbcp. SQLNestedException: Cannot create PoolableConnectionFactory ([Microsoft] [SQLServer 2000 Driver for JDBC] Error establishing socket .) this is a small problem, because my SQLSERVER2K service is changed to manual, so we need to manually start SQLSERVER2K every time after startup. Because I did not remember the startup at once, I reported some errors, so if you often use SQLSERVER2K, you 'd better not manually start it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.