Wiley - Java Database Programming Bible (2002).pdf

(6333 KB) Pobierz
15337524 UNPDF
Table of Contents
Java Database Programming Bible
by John O'Donahue
ISBN:0764549243
John Wiley & Sons © 2002 (702 pages)
Packed with lucid explanations and lots of real-world examples, this comprehensive guide gives you
everything you need to master Java database programming techniques.
Companion Web Site
Table of Contents
Java Database Programming Bible
Preface
Part I - Introduction to Databases, SQL, and JDBC
Chapter 1
- Relational Databases
Chapter 2
- Designing a Database
Chapter 3
- SQL Basics
Chapter 4
- Introduction to JDBC
Part II - Using JDBC and SQL in a Two-Tier Client/Server Application
Chapter 5
- Creating a Table withJDBC and SQL
Chapter 6
- Inserting, Updating,and Deleting Data
Chapter 7
- Retrieving Data withSQL Queries
Chapter 8
- Organizing Search Results and Using Indexes
Chapter 9
- Joins and Compound Queries
Chapter 10 - Building a Client/Server Application
Part III - A Three-Tier Web Site with JDBC
Chapter 11 - Building a Membership Web Site
Chapter 12 - Using JDBC DataSources with Servlets and Java Server Pages
Chapter 13 - Using PreparedStatements and CallableStatements
Chapter 14 - Using Blobs and Clobs to Manage Images and Documents
Chapter 15 - Using JSPs, XSL, and Scrollable ResultSets to Display Data
Chapter 16 - Using the JavaMail API with JDBC
Part IV - Using Databases, JDBC,and XML
Chapter 17 - The XML Document Object Mo del and JDBC
Chapter 18 - Using Rowsets to Display Data
Chapter 19 - Accessing XML Documents Using SQL
Part V - EJBs, Databases, and Persistence
Chapter 20 - Enterprise JavaBeans
Chapter 21 - Bean-Managed Persistence
i
Team-Fly ®
15337524.001.png 15337524.002.png
Table of Contents
Chapter 22 - Container-Managed Persistence
Chapter 23 - Java Data Objects and Transparent Persistence
Part VI - Database Administration
Chapter 24 - User Management and Database Security
Chapter 25 - Tuning for Performance
Appendix A - A Brief Guide to SQL Syntax
Appendix B - Installing Apache and Tomcat
Index
List of Figures
List of Tables
List of Listings
List of Sidebars
ii
 
Preface
Preface
Welcome to Java Database Programming Bible . This book is for readers who are already
familiar with Java, and who want to know more about working with databases. The JDBC
Application Programming Interface has made database programming an important
aspect of Java development, particularly where Web applications are concerned.
The ease with which Java enables you to develop database applications is one of the
main reasons for Java's success as a server-side development language. Database
programming is perhaps the key element in developing server-side applications, as it
enables such diverse applications as auction sites, XML-based Web services,
shipment-tracking systems, and search engines.
What this Book Aims to Do
The aims of this book are to give you a good understanding of what a relational database
is, how to design a relational database, how to create and query a relational database
using SQL, and how to write database-centric applications in Java. There are many
books that cover individual aspects of the aforementioned topics, such as SQL or JDBC.
The intention of this book is to provide a single source of information and application
examples covering the entire subject of relational databases.
When I first started to develop database-driven applications in Java, I was working with a
database administrator who was responsible for the database side of the project. This is a
fairly common approach to managing larger database-driven applications, since it places
responsibility for the database in the hands of a database expert and allows the Java
programmer to concentrate on his or her own area of expertise. The disadvantages of this
approach only became apparent when some of my code proved to be unacceptably slow
because of database design considerations that failed to take into account the needs of
the business logic.
Working on subsequent smaller projects enabled me to manage my own databases and
develop an understanding of how to design databases that work with the business logic. I
also learned about the tradeoffs involved in using indexes and the importance of
normalization in designing a database. Perhaps the most important thing I learned was
that, thanks to the design of the JDBC API and the universality of the SQL language,
much of what you learn from working with one database-management system is directly
applicable to another.
Although this book aims to give you a good overall understanding of Java database
programming and, in particular, to cover the JDBC API thoroughly, it is impossible to
cover either all of the different JDBC drivers currently available or all the variations of the
-1 -
Preface
SQL language in a book of this nature. The examples in this book were developed using a
number of different JDBC drivers and RDBMS systems; Part II of the book addresses the
ease with which you can use the same code with different drivers and different
database-management systems.
You will find, as you work with a variety of different Relational Database Management
Systems, that the SQL standards are really just guidelines. SQL has as many different
dialects as there are relational database management systems. So although the
examples in this book should work with only minor changes on virtually any RDBMS, you
would be well advised to read a copy of the documentation for your own
database-management system.
Who Should Read this Book
This book is aimed at all levels of programmers, including those with no prior database
experience. However, you should already have some experience with Java basics and
Swing, so no attempt has been made to explain this book's examples at that level. The
server-side applications are introduced with a brief discussion of servlets and Java Server
Pages, supported by the information in Appendix B on downloading and installing the
Apache HTTP server and the Tomcat servlet and JSP eengine. If you are looking for a
beginner-level Java book, consider Java 2 Enterprise Edition Bible (ISBN 0-7645-0882-2)
by Justin Couch and Daniel H. Steinberg. For the beginning- to-intermediate-level
programmer, Java Database Programming Bible introduces all the various technologies
available to you as a J2EE programmer. If you have never used J2EE before, this book
will show you where to start and the order in which to approach your learning.
For the more advanced-level programmer, this book serves as a guide to expanding your
horizons to include the more concentrated areas of programming. Use this book as a
guide to exploring more possibilities within the area that you have already been working
on or to find new ways to address a problem. Finally, you can use this book to learn about
new areas that you may have not heard of before. Because of the breadth of J2EE, it is
always possible that new topics exist that you haven't heard of. Even after six-plus years
of Java programming experience, I am constantly finding new items popping up that I
want to learn about.
How to Use this Book
This book is divided into a number of parts. Each part covers a different aspect of the
technology, while the chapters focus on individual elements. The examples in the various
chapters are intended to provide a set of practical applications that you can modify to suit
your own needs.
-2 -
 
Preface
The depth of coverage of each aspect of the technology is sufficient for you to be able to
understand and apply Java database programming in most of the situations you will
encounter. However, this book assumes that you are comfortable downloading and
working with the Javadocs to ferret out the details of an API. Unlike some books, Java
Database Programming Bible does not reproduce the Javadocs within its covers.
This book's approach is to present the different aspects of the technology in the context of
a set of real-world examples, many of which may be useful as they are, although some
may form the foundation of your own applications. For example, the book presents JDBC
core API in the context of a simple Swing application for the desktop, while the extension
API is covered in a series of server-side Web applications.
Since I have never read a programming book from cover to cover, I don't expect you to,
either. Individual chapters and even examples within chapters are intended to stand by
themselves. This necessarily means that there is a certain amount of repetition of key
concepts, with cross-references to other parts of the book that provide more detail.
If you don't have much of an understanding of database technology, I do recommend that
you read Part I , which introduces the basic concepts. If you know something about the
JDBC core API, but you are not familiar with the extension API, you might want to read
just the JDBC chapter in Part I to see how it all fits together.
This book is made up of six parts that can be summarized as follows.
Part I : Introduction to Databases, SQL, and JDBC
The introductory chapters discuss what a relational database is and how to create and
work with one. This part is concerned mainly with the big picture, presenting overviews of
the technology in such a way that you can see how the parts fit together. This part
contains an overview of the SQL language, as well as an explanation of JDBC as a
whole.
Part II : Using JDBC and SQL in a Two-Tier Client/Server Application
Part II presents the JDBC core API and SQL in the context of a series of desktop
applications. These applications are combined in the final chapter of this part to form a
Swing GUI that can be used as a control panel for any database system. A key concept
presented in this part of the book is the way that JDBC can be used with any RDBMS
system by simply plugging in the appropriate drivers.
Part III : A Three-Tier Web Site with JDBC
One of the most common Java database applications is the creation of dynamic Web
sites using servlets, JSPs, and databases. This part discusses the JDBC extension API in
the context of developing a Web application. It also talks about using JDBC and SQL to
-3 -
 
Zgłoś jeśli naruszono regulamin