oftware drivers, if I may borrow a quote from Rodney Dangerfield, "Don't get no respect." Most developers think about drivers as minor utilities with limited functionality. But drivers often do more than serve as simple data translators or pipes. They have important features that can impact both the performance and the functionality of your applications.
Java developers often require access to a variety of data sources, including relational databases. JDBC drivers connect Java programs to these data sources using the JDBC standard. Before JDBC, Java developers accessing data sources, such as relational databases, were forced to wrestle with complex SQL statements to write applications with intensive database transactions. So, Sun Microsystems and DataDirect Technologies (formerly the DataDirect division of MERANT) developed JDBC as an API intended to make it easier to write Java applications that could access a variety of data sources.
Once you start to investigate JDBC drivers, you will soon discover just how overwhelming are the choices you have. Choice is good; but the Sun Microsystems web site, for example, lists over 150 JDBC drivers without much guidance on how to tell a good driver from a bad one! Although each driver is described as supporting some of the main feature sets, you are left with the question: what do those features really mean to me in a practical way? That's what we'll discuss in this article.
So Many Choices
Let's begin with some of the fundamentals of the JDBC standard and drivers that support it. First, JDBC provides methods that do these basic things:
- Create and manage connections to data sources based on a URL or DataSource object registered with a Java Naming and Directory Interface (JNDI) naming service. Thus, no client-side configuration is required.
- Compose and send SQL statements to the data sources.
- Retrieve and process result sets that are returned to the Java application or applet.
JDBC allows developers to make Java program calls that are translated into SQL statements to access tabular data sources. These data sources include enterprise SQL databases such as Oracle, SQL Server, IBM UDB, Informix, Sybase, and others, but also include spreadsheets and flat-file data sources such as CSV, TSV, and mainframe data files.
With JDBC, it's possible to update data from multiple data fields with a single command and multiple data sources (tables) in a single transaction. This has the following implications:
- It means you can optimize data access performance through batching.
- It provides a common framework by which multiple vendors' products may be accessed, regardless of whether these products interoperate with one another
- It provides a means of abstracting the data source, making it easier to re-specify a data source if it is changed or moved.
JDBC provides a way to access data stores over the Internet when the software used by the client or the middleware used by middle-tier servers is out of the control of the developer. It leverages the portable, self-contained nature of Java and obviates the need for multiple versions of the same application.
JDBC offers the following benefits:
- Access to existing and legacy data sets
- Database connectivity to a variety of industry-leading databases
- A simplified and standardized API based on Java that provides a "responsible broker" to middle-tier applications
- Zero configuration for network computers, with no client-side support, leading to centralized software maintenance and reduced Total Cost of Ownership (TCO).
|