[ Team LiB ] Previous Section Next Section

Chapter 10. Managing Database Connectivity Using JDBC

by Subramanian H Kovilmadam

IN THIS CHAPTER

The heart of any enterprise application is usually a database, where applications store and access data for providing business functionality. Several types of databases are available in the market. The same application often has to access more than one database to provide business functionality. Therefore, it is imperative for enterprise applications to have a standard, uniform mechanism of accessing a wide range of databases. Sun Microsystems' Java Database Connectivity API (JDBC) provides such a mechanism for Java-based applications that require access to the enterprise data. JDBC enables you to submit Structured Query Language (SQL) commands to any JDBC compliant database.

JDBC, like Microsoft's Open Database Connectivity (ODBC) standard, addresses the issue of a mechanism for uniform connectivity to databases. Both JDBC and ODBC are based on the Open Group (X/Open) SQL Call Level Interface (CLI) standard. Without these APIs, applications must use the APIs provided by the individual databases to access them. Using JDBC, you can code to a single standard API, and then plug-and-play different database drivers depending on which database you want to access. This mechanism clearly separates development and deployment activities, and also enables easy migration between databases.

Another advantage of using such a mechanism is that you no longer need to pre-compile embedded SQL statements in your code. If you have worked with a language such as Pro-C, you might be familiar with the requirement of pre-compiling your code, when the SQL statements are converted into native C language constructs. Because this is no longer necessary using JDBC, it makes your application more portable and also facilitates cleaner client/server relationships.

WebLogic Server 8.1 supports JDBC v2.0. In this chapter, we discuss some basic JDBC concepts and focus on the JDBC features provided by WebLogic Server 8.1.

    [ Team LiB ] Previous Section Next Section