# J2EE Compliance: Java Transaction API and javax.sql Interfaces

J2EE, or the Java 2 Platform, Enterprise Edition, is a standard for development of enterprise applications based on reusable components in a multi-tier environment. In addition to the features of the Java 2 Platform, Standard Edition (J2SE) J2EE adds support for Enterprise Java Beans (EJBs), Java Server Pages (JSPs), Servlets, XML and many more. The J2EE architecture is used to bring together existing technologies and enterprise applications in a single, manageable environment.

Derby is a J2EE-conformant component in a distributed J2EE system. As such, Derby is one part of a larger system that includes, among other things, a JNDI server, a connection pool module, a transaction manager, a resource manager, and user applications. Within this system, Derby can serve as the resource manager.

For more information on J2EE, see the J2EE specification available at http://java.sun.com/javaee/reference/ .

In order to qualify as a resource manager in a J2EE system, J2EE requires these basic areas of support:

- JNDI support

  Allows calling applications to register names for databases and access them through those names instead of through database connection URLs. Implementation of one of the JDBC interfaces, javax.sql.DataSource, provides this support.

- Connection pooling

  A mechanism by which a connection pool server keeps a set of open connections to a resource manager (Derby). A user requesting a connection can get one of the available connections from the pool. Such a connection pool is useful in client/server environments because establishing a connection is relatively expensive. In an embedded environment, connections are much cheaper, making the performance advantage of a connection pool negligible. Implementation of two of the JDBC interfaces, javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection, provide this support.

- XA support

  XA is one of several standards for distributed transaction management. It is based on two-phase commit. The javax.sql.XAxxx interfaces, along with java.transaction.xa package, are an abstract implementation of XA. For more information about XA, see X/Open CAE Specification-Distributed Transaction Processing: The XA Specification, X/Open Document No. XO/CAE/91/300 or ISBN 1 872630 24 3. Implementation of the JTA API, the interfaces of the java.transaction.xa package (javax.sql.XAConnection, javax.sql.XADataSource, javax.transaction.xa.XAResource, javax.transaction.xa.Xid, and javax.transaction.xa.XAException), provides this support.

With the exception of the core JDBC interfaces, these interfaces are not visible to the end-user application; instead, they are used only by the other back-end components in the system.
Note: For information on the classes that implement these interfaces and how to use Derby as a resource manager, see Chapter 6, "Using Derby as a J2EE Resource Manager" in the Java DB Developer's Guide.

- The JTA API
- javax.sql: JDBC Interfaces