Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

This article guides you through the JDBC features in the Apache Geronimo appplication server. To demonstrate the JDBC features, we use a simple Inventory application which has JSP, Servlets to handle web related features and inbuilt Derby as database.

...

Overview of JDBC Features Anchor overviewoverview

JDBC implementation in application servers vary from application server to other. Following table gives a feature list of JDBC in Apache Geronimo.

Feature

Description

JDBC access

Geronimo does not have any direct integration with JDBC but supports access through the generic J2CA framework. The TranQL project has J2CA adapters for various databases.

JCA implementation

Geronimo supports the JCA 1.5 specification and is backward compatible to the JCA 1.0 specification.

Data sources supported

TranQL has generic wrappers for each data sources.

Data source failover

TranQL has specialized drivers for certain databases (including Apache Derby, Oracle and DB2) that provide a tighter integration with the advanced features of the driver.
It is at this level that features such as load-balancing and failover would be provided. You can also use a C-JDBC wrapper for providing database clustering and failover.

XA support

Supports XA transactions, Local Transactions, and No transaction.

Connection Manager Configurability

The J2CA framework is interceptor based which allows different parts of the connection framework to be plugged in.

JTA implementation

Transaction support is provided through Geronimo Specific Transaction Managing Framework and HOWL.

Connection pooling and management

Custom Geronimo Code and TranQL used for connection pooling and management.

Legacy driver support

Geronimo provides this through the TranQL- connector JDBC to JCA wrapper in Geronimo. Supports JDBC 3.0 and 2.1.

Application Overview Anchorapplicationapplication

The Inventory application in this article only supports three basic usecases of such applications.

...

The list of web application files in the application is depicted in the following.

...

...

Application defines a datasource with the help of geronimo-web.xml and web.xml files. geronimo-web.xml add a link to the database pool that is packaged with the EAR file.

...

...

Following is the web.xml of the Inventory application. It uses same name as in the geronimo-web.xml, which is used to create the datasource.

...

...

geronimo-application.xml tells the application that there is a database pool that needs to be deployed as well. The db pool is defined in InventoryPool.xml and the driver that is needs in order to be deployed is the tranql-connector-ra-1.3.rar file--these two files will reside on the top level layer of the resultant EAR file.

...

Next important phase of the application is accessing defined datasource from the source code. This part is handled by the DBManager class.

...

.

...

...

Sample Database

The sample database that is being used to demonstrate this application is in-built Derby database. The name of the sample database is InventoryDB and it consists of two tables, namely ITEM and ITEM_MASTER. The fields for each of these tables are described below.

...

Configuring, Building and Deploying the Sample Application Anchorconfigureconfigure

Download the Inventory application from the following link:
Inventory

...

After starting Apache Geronimo log into the console and follow the given steps to create the InventoryDB database.

...

  1. Select DB Manager link from the Console Navigation panel on the left.
  2. Give the database name as InventoryDB and click Create button.
  3. Select InventoryDB to the Use DB field.
  4. Open InventoryDB.sql in the inventory/inventory-ear/src/main/resources directory from a text editor.
  5. Paste the content InventoryDB.sql to the SQL Commands text area and press Run SQL button.

...

Testing of the Sample Application Anchortestingtesting

To test the sample application, open a browser and type http://localhost:8080/inventory. The Welcome page of Inventory application which is acts as a notice board will be loaded.

...

The user can directly access Add Items, Receive Goods and Issue Goods functionalities from the Welcome page.

Summary Anchorsummarysummary

This article has shown you how to use JDBC features inside the Geronimo Application Server. You followed step-by-step instructions to build, deploy and test a sample application to elaborate these features.

...