Configuration of Tomcat SQL Server2000 database connection pool in JSP

Source: Internet
Author: User
Tags microsoft sql server resource tomcat

Environment:

1. Database: Microsoft SQL Server 2000

2. Database driver: Net.sourceforge.jtds.jdbc.Driver

JNDI (Java naming and Directory Interface) Overview:

TOMCAT4 (5) provides a Jndi--initialcontext implementation instance that is compatible with the Java Enterprise Edition application service. Its initial data is set in the $catalina_home/conf/server.xml file and may be referenced by the following elements in the Web application Environment Description (/web-inf/web.xml):

1 <env-entry>--Environment Entry, set how the application operates.

2 <resource-ref>--resource parameters, generally is the database driver, JavaMail session, custom class factory and so on.

3) <resource-env-ref>--is used in servlet 2.4 to simplify the setting of resource resources such as environment parameters and RESOURCE-REF variables that do not require authentication information.

InitialContext is set up when Web application initialization is used to support Web page application components. All the portals and resources are placed in the java:comp/env section of the Jndi namespace. Click on the following URL to get more information:

1 Java Naming and catalog interface (Java naming and directory Interface)

2) Java Platform Description (Java Platform specification)

Setting Jndi Resources

To set the Jndi resource, use the following markers in the $catalina_home/conf/server.xml file:

1) <environment>--sets the name and value of the variable Jndi initialcontext entry in the domain (as stated above <env-entry> equivalence).

2) <resource>--sets the name and type of the resources available to the application (as stated above <resource-ref> equivalence).

3) <resourceparams>--set the name of the Java Resource class factory or the JavaBean attribute to be used.

4) <resourcelink>--adds a link to the global Jndi environment (Jndi context).

These markers must be placed between <Context> and </Context> (for specialized web applications) or between <DefaultContext> and </DefaultContext>.

In addition, the names and values located in the Web Application Environment description (Web application descriptor) (/web-inf/web.xml) are also set in the initial environment (Initial context) when the <Environemt> The initial value is reset when the element value is allowed.

Global variables can be set in <GlobalNamingResources> of <Server> child elements.

Related Article

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.