Configuration of tomcat SQL Server2000 database connection pool in JSP
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 an InitialContext implementation instance that is compatible with Java Enterprise Edition application services. Its initial data settings are 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, which sets how the application operates.
2) <resource-ref> -- resource parameters, such as database drivers, JavaMail sessions, and custom factory.
3) <resource-env-ref> -- used in Servlet 2.4 to simplify setting resource resources that do not require authentication information, such as environment parameters and resource-ref variables.
InitialContext is set during webpage application initialization to support webpage application components. All entries and resources are stored in the java: comp/env segment of the JNDI namespace. Click the following URL for more information:
1) Java Naming and Directory Interface (Java Naming and Directory Interface)
2) J2EE Platform description (J2EE Platform Specification)
Set JNDI resources
To set a JNDI resource, use the following identifier in the $ CATALINA_HOME/conf/server. xml file:
1) <Environment> -- set the name and value of the variable JNDI InitialContext entry of the domain (<env-entry> is equivalent to the one mentioned above ).
2) <Resource> -- set the name and type of the available resources of the application (<resource-ref> is equivalent to the one mentioned above ).
3) <ResourceParams> -- set the name of the Java resource factory or the an attribute to be used.
4) <ResourceLink> -- add a link to the global JNDI Context.
The above flags must be placed between <Context> and </Context> (for specialized web applications), <DefaultContext>, and </DefaultContext>.
In addition, the Web Application Descriptor (/WEB-INF/web. the name and value in xml are also set in the Initial environment (Initial Context). When allowed by the <Environemt> element value, the Initial value is reset.
You can set global variables in <Server> child elements <GlobalNamingResources>.
Database connection pool overview:
Database Connection is a key, limited, and expensive resource, which is particularly prominent in the web applications of multiple users. Database Connection Management can significantly affect the scalability and robustness of the entire application, and affect the performance indicators of the program. The database connection pool is designed to address this issue.
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.