Previous | Table of Contents | Next

Page 503

Page 504

JDBC

As mentioned earlier, JDBC provides the standard interface between Java and the database. At this point, I would like to take a brief minute and discuss JDBC.

JDBC (Java Database Connectivity) is a standard relational database access interface. It's somewhat analogous to Microsoft's ODBC (Open Database Connectivity) in that JDBC is driver based and database independent. JDBC is widely supported by third-party tool vendors and many popular databases. As such, JDBC will remain the main database access mechanism for Java for the near future.

JDBC requires an operating system driver to access the relational database. Several company vendors provide generic JDBC-ODBC bridge drivers that allow any ODBC driver to be used with JDBC. With these bridge drivers, the JDBC API acts as a wrapper for the underlying ODBC calls. To use the drivers, place JDBC calls within your Java source code.

Unfortunately, being driver based is also the main disadvantage of JDBC. JDBC requires the drivers to be installed on the same platform as the JDBC application, which means that Java and the drivers must be installed with the Internet browser. This adds to the complexity of the overall application architecture. This is a limitation you must endure to have the Java-relational database connectivity. Another limitation of JDBC is that it provides access to the standard SQL types only and does not support the Oracle-specific types such as ROWID.

Even though JDBC has these few limitations, it does offer the following benefits:

PL/SQL Versus Java

PL/SQL and Java have many similarities and common strengths that make them both outstanding programming languages. Likewise, they have some differences that are attributable to their purposes and origins. PL/SQL and Java compare and contrast as follows:

Page 505

The World Wide Web and SQL

Over the past several years, the primary user interface to the Internet and the World Wide Web (WWW) has been the browser. Internet browsers from companies such as Oracle, Microsoft, and Netscape primarily access Web pages, which are written in Hypertext Markup Language (HTML) and Java.

You learned earlier in this chapter that Java and J/SQL can be integrated to give Java access to an RDBMS. J/SQL opens the door and allows Web pages that use Java to access Oracle databases. This RDBMS access from a Web browser is the architecture of the future. In fact, it has already begun. Internet applications such as E-COMMERCE (Electronic Commerce) would not be possible without this Web-page-to-database connectivity. E-COMMERCE is the applications that allow you to perform sales and purchasing activities over the Internet. Figure 21.2 illustrates typical scenarios for the processing of SQL statements through a Web page or a Web server.

At this point, I want to share with you several options, other than J/SQL and JDBC, that enable you to have Java-to-RDBMS connectivity. Although I prefer and recommend J/SQL, it's important and reasonable for me to review alternatives with you:

Previous | Table of Contents | Next

Используются технологии uCoz