Database Programming with JDBC and Java
Java and databases make a powerful combination. Getting the two sides to work together, however, takes some effort-largely because Java deals in objects while most databases do not. This book describes the standard Java interfaces that make portable object-oriented access to relational databases possible and offers a robust model for writing applications that are easy to maintain. It introduces the JDBC packages and uses them to develop three-tier applications (applications divided into a user interface, an object-oriented logic component, and an information store). The second edition also explains the relationship between JDBC and Enterprise JavaBeans. If you use Enterprise JavaBeans, JDBC can handle object persistence; if you choose not to use Enterprise JavaBeans, this book shows you how to achieve many of the same goals in your own code. The book begins with a quick overview of SQL for developers who may be asked to handle a database for the first time. It then explains how to issue database queries and updates through SQL and JDBC. It also covers the use of stored procedures and other measures to improve efficiency, where these are available. But the book's key contribution is a set of patterns that separate the various functions of the Java application and facilitate the growth and maintenance of your application. Patterns let you isolate critical tasks like object creation, information storage and retrieval, and the committing or aborting of transactions. The second edition includes more basics of JDBC and SQL, with more examples, suggestions for integrating JDBC with Swing using the model-view-controller model, and a deeper discussion about the architecture of a robust, maintainable database application. If you have a database at your site and have studied Java, this book will help you become a more effective application developer for Java database programs. It has been completely updated for JDBC 2.0, including full coverage of the JDBC 2.0 Optional Package (formerly known as the JDBC 2.0 Standard Extension). The book includes reference listings for both the JDBC Core (Java.sql) and the JDBC Optional Package (javax.sql) APIs.