Chapter 8. Introduction to JDBC

JDBC is the Java database connectivity API. It is the foundation of all database features in Java. We can avoid using JDBC directly, for example, by using SQLJ to embed SQL statements in our Java code, but this code needs to be processed by an SQLJ preprocessor, which translates our SQLJ statements into JDBC. There are other database technologies for Java, EJB (Enterprise JavaBeans) and JDO (Java Data Objects), which hide JDBC behind the scenes for us and allow us to concentrate on objects, but they require additional software and learning a new way to program.

JDBC is not difficult to program, though it can be somewhat tedious because of the number of classes and methods involved and, especially, the number of steps required to process a query.

One drawback of using JDBC directly as opposed to using a mapping layer, such as EJB or JDO, which can hide database details is that it introduces dependencies between the Java code and the database but this can be ameliorated by careful design. It is usually best to encapsulate JDBC code in a data access layer comprising a limited number of classes.



Java Oracle Database Development
Java Oracle Database Development
ISBN: 0130462187
EAN: 2147483647
Year: 2002
Pages: 71

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net