Chapter 13: JDBC Connectivity JDBC 4 corrected this
Chapter 13: JDBC Connectivity JDBC 4 corrected this problem by providing a way for the pool manager to ask a connection if it is still valid. For this to work properly, it will require: . The JDBC driver to implement this JDBC 4 feature, enabling a connection s validity to be queried . The application server pool manager to support this feature to query connection validity regularly to avoid having bad connections remaining in the pool At the time of this writing, JDBC 4 specification has just been finalized, and implementations from commercial vendors or open source products are just starting to be available for early access. Tomcat and the JDBC Evolution Application developers and system designers using Tomcat 6 have a wide choice of JDBC support mechanisms from which to choose. Tomcat 6 provides JDBC 3 support while offering full backward compatibility to JDBC 2 (as well as JDBC 1). The remainder of this chapter examines the recommended mechanism to access JDBC resources while working with Tomcat, and explores one alternative access mechanism. The major new JDBC features that are part of Tomcat 6 include the following: . Application server managed database connection pools: Tomcat 6 uses Jakarta Commons Database Connection Pooling (DBCP) to provide container-managed connection pooling. This also enables flexible configuration for the pooling mechanism (see the section Resource and ResourceParams, later in this chapter). JDBC 3 is the first specification that defines standard configuration parameters for pooling (such as maxStatements, initialPoolSize, minPoolSize, maxPoolSize, and maxIdleTime), making the mechanism more configurable in a standards-compliant manner. . Using the JNDI-API to look up data sources within an application server: Tomcat 6 emulates JNDI for Web applications running under it. This is a portable and configurable way of obtaining data sources for JDBC operations without hard-coding the driver and associated properties. It makes the selection of the JDBC driver and RDBMS instance a deferred deployment-time decision. JDBC 3 specifies JNDI as the preferred method for applications to locate a data source. . Ease of migration to the connector architecture: Tomcat 6 s decoupled architecture for access to JDBC data sources (through JNDI lookup) is a first step in the migration toward the JCA Connector based architecture. JNDI Emulation and Pooling in Tomcat 6 Tomcat provides valuable services for hosted Web applications that use JDBC connections. More specifically, Tomcat enables running Web applications to do the following: . Access JDBC data sources using standard JNDI lookup . Use connection pooling value-added service
For reliable and cheap web hosting services please check cheap web hosting website.