Welcome!

Java Authors: Don MacVittie, Maureen O'Gara, Liz McMillan, Walter H. Pinson, III, Yakov Werde

Related Topics: Java

Java: Article

JDBC – The Indispensable Component of Persistence Mechanisms

A dive into the details of O/R mapping mechanisms

Although EJB 3.0 provides a standard set of interfaces, the configuration for each implementation will likely vary to some degree. In the following example, we look at how Oracle's EJB 3.0 implementation is configured with the DataDirect Connect for JDBC driver for the Oracle database.

You can obtain a copy of Oracle's 10.1.3 J2EE Container (OC4J) from www.oracle.com/technology/software/products/ias/preview.html, and the DataDirect Connect for JDBC Driver for the Oracle database from www.datadirect.com/products/jdbc/index.ssp. Then, copy the driver JAR files to this location:

cp 'base.jar utils.jar and oracle.jar'
$ORACLE_HOME/j2ee/home/applib

Next, create a DataSource in data-sources.xml located in the following directory:

$ORACLE_HOME/j2ee/home/config

For an Oracle database, configure the DataDirect driver as a managed data source:

<managed-data-source
name="OracleDataSource"
jndi-name="jdbc/DDOracleDS"
description="Managed DataSource">
connection-pool-name="myConnectionPool"/>

Include the following data that defines a connection pool.

<connection-pool
name="myConnectionPool"
min-connections="10"
max-connections="30"
inactivity-timeout="30">
<connection-factory
factory-class="com.ddtek.jdbcx.oracle.OracleDataSource"
user="scott"
password="tiger"
url="jdbc:datadirect:oracle://<HOST>:1521"/>
</connection-factory>
</connection-pool>

Persistence Mechanisms - Comparison
Having discussed the various backgrounds of today's market-leading O/R mapping mechanisms, there are many considerations that you need to keep in mind when making your choice. Table 1 summarizes the key technical, business, and support capabilities that you will want to consider when choosing a Persistence framework.

JDBC - The Critical Link
O/R technologies excel at providing an object-oriented view of relational data while eliminating the development effort relating to the persistence model. Since the O/R mapping mechanisms generate efficient JDBC calls to access the database, some people argue that the relative importance of the JDBC driver has been reduced. But, as with any architecture, the overall efficiency of the application will be greatly affected by the weakest layer in the application stack. Regardless of the JDBC code that is generated, the O/R mapping mechanisms lack the ability to control how the drivers interact with the database. At the end of the day, the efficiency of the application is in large part dependent on the ability of the JDBC driver to securely move data between the application and the database with the greatest level of performance, scalability, and reliability. The ability of the driver to efficiently communicate with the wire-level protocol exposed by the database and to efficiently manage packet transmission as it relates to fetching data and performing updates is fundamental to the application. Although there are many factors to consider when selecting a JDBC driver (interoperability, standards leadership, technical support, etc.), selecting the best possible JDBC driver based on performance, scalability, and reliability is key to realizing the benefits of applications that are based on an O/R framework.

Conclusion
O/R mapping mechanisms offer a compelling model for many developers looking to overcome the impedance mismatch associated with object and relational data constructs. O/R technologies improve developer productivity by eliminating the development effort associated with managing persistence, allowing the developer to focus on the application's business logic. Although there are many factors to consider when selecting an O/R technology, the recent trend to reconcile the O/R mapping APIs should prove beneficial to all development organizations. While some organizations are motivated by the developer productivity gains associated with using an O/R mapping mechanism, it is extremely important to the overall success of the application to leverage best-of-breed components at each layer in the architecture stack. Leveraging an industry-leading JDBC driver that provides the performance, scalability, reliability, and security that is necessary in today's applications is critical to the overall success of the O/R infrastructure.

More Stories By Jonathan Bruce

Jonathan Bruce is program manager at DataDirect Technologies. He has led and participated in four JSRs and enjoys helping Java and .NET developers take advantage of the benefits XQuery offers when working with XML and a variety of databases. Recently relocated from San Fransisco to North Carolina, Jonathan spends his weekends running, sailing, and traveling.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Tony Walker 11/16/05 09:40:15 AM EST

Not a bad article, but it's a pity you didn't include JDO and some of the newer ideas like db4o and Persistent Java Objects in the evaluation.

JDO is a standards-based direct competitor to Hibernate, with many implementations to choose from.

Persistent Java Objects is a new system well suited to RAD. It requires no mapping, and so is very fast to implement and easy to modify.

JDJ News Desk 11/01/05 03:53:17 PM EST

JDBC -The Indispensable Component of Persistence Mechanisms. Few serious database applications are considered enterprise-worthy without a core database engine backed by a normalized and optimized relational database architecture. Traditionally, such database applications rely on SQL statements to retrieve and update data in the back-end data source.