![JDBC Developer's Resource](http://prodimage.images-bn.com/pimages/9780139016615_p0_v1_s192x300.jpg)
JDBC Developer's Resource
by Art TaylorView All Available Formats & Editions
Learn how to put JDBC to work for you with this updated guide, JDBC Developer's Resource, Second Edition. Quickly master the fundamentals, including JDBC's interface and methods, and its relationship to ODBC. Then follow the code examples to see how JDBC can work for you in many different applications in both two- and three-tiered computing environments. With the… See more details below
Overview
Learn how to put JDBC to work for you with this updated guide, JDBC Developer's Resource, Second Edition. Quickly master the fundamentals, including JDBC's interface and methods, and its relationship to ODBC. Then follow the code examples to see how JDBC can work for you in many different applications in both two- and three-tiered computing environments. With the tools and resources included on the free CD-ROM, you will progress rapidly from case studies to building your own JDBC solutions, all following step-by-step models taken from real-life situations.
Editorial Reviews
Product Details
- ISBN-13:
- 9780139016615
- Publisher:
- Prentice Hall
- Publication date:
- 12/21/1998
- Series:
- Informix Press Series
- Edition description:
- 2ND BK&CDR
- Pages:
- 648
- Product dimensions:
- 7.02(w) x 9.22(h) x 1.88(d)
Read an Excerpt
PREFACE: The Java Language and JDBC
Since its inception in 1995, the Java language has generated intense interest in the computer industry. The Java Database Connectivity (JDBC) standard adds a whole new dimension to this capable and multi-faceted language. Rather than simply being used to "bring life to Web pages," Java with JDBC can now fill the role of database-aware applications for a variety of application needs. Where currently common gateway interface (CGI) applications are required to access databases from within Web browsers, Java applets with JDBC now have the potential to provide this functionality with more direct programming and the potential for improved performance.
Using this API, you can now use Java applications for standard database programming tasks such as reports or updates. With Java's flexible network API, you can use Java/JDBC applications for filter programs, to read data from a data stream, and to provide conversion facilities before updating a database.
Java applications written using JDBC are portable both for the hardware platform and the database. You can run a correctly written Java/JDBC program on a variety of platforms against a variety of databases without any code changes. This is possible because JDBC is based on ODBC, which is in turn based on the X/Open CLI specification. The goals of the X/Open group have been met to the extent that database access standards have been accepted by the industry. Access to all major databases is available through ODBC. And JDBC-ODBC bridges are available to provide database access by mapping JDBC calls to their corresponding ODBC calls. Thus, any database that is accessiblewith an ODBC driver is also accessible with a Java/JDBC driver using the JDBC-ODBC bridge.
JDBC uses the industry standard Structured Query Language (SQL) to communicate with the database. Writing a JDBC application, therefore, requires knowledge of both the Java language and SQL. To provide a refresher, this book includes sections on both of these languages. These chapters are intended to help those who have had moderate exposure to these languages. For those with no experience in SQL, additional training is recommended.
About This Book
This book is designed to provide you with a thorough grounding in the JDBC API. It is divided into two parts: a tutorial and a reference. The tutorial part provides a primer on the Java language and relational databases. This is followed by a set of examples that demonstrate the process of programming database applications using JDBC. This part begins with simple examples and then progresses into more complex applications.
The reference part provides several listings of the methods available in JDBC. A brief, quick reference of the methods is provided, followed by a more detailed description of the methods arranged by JDBC interfaces.
Target Audience
If you use Java and have a need to perform database access, then this book is for you. This book presumes the reader is an experienced programmer, but not necessarily a Java programmer. This book is designed to be a useful resource for both the experienced and inexperienced Java programmer. A programmer just learning the Java language will find the JDBC library is similar in design to the other Java libraries and just as easy to use. This book will provide the guidance and the code samples to easily complete a JDBC application.
Java has intentionally been designed with a syntax similar to C/C++, so a programmer familiar with either of these languages will be able to use Java. And a programmer familiar with object-oriented concepts will be comfortable with JDBC and it's object-oriented design.
If you are one of those individuals very familiar with C but with moderate exposure to C++ or Java, then this book provides a Java overview to present some of the more important Java concepts. Having read these sections, an experienced programmer will have no problem understanding the numerous code samples presented in this book.
Resource
This book is designed to be both a tutorial and a reference combined into a single book: a complete 'developer's resource.' As a reference book, a quick reference section contains all methods in the class library and a short description of the method. A second reference section lists all JDBC interface descriptions and provides a code sample for virtually all JDBC methods.
This book is designed to be a complete JDBC resource. A tutorial section is provided to demonstrate how to use JDBC with Java. With the belief that a good code sample is worth a 1000 words, numerous code samples provide a 'picture' of how to access data using JDBC.
A complete reference section is also included. The entire JDBC class library is covered with code samples provided for most of the methods.
An experienced programmer with solid Java experience could read the sections of the tutorial that cover basic JDBC programming, use the reference section as needed, and quickly develop a working JDBC application. A less-experienced Java programmer could read the Java primer section and the tutorial section, and then use the reference section as a reference to develop a JDBC application.
Conventions Used in This Book
You'll notice as you read this book that there are several conventions used to help make especially useful material easier to read and to locate when you're using this book as a reference during your programming sessions.
Source Code
All code fragments and listings that have been set off from the main text of this book have been formatted in the following way:
StringBuffer DTString = "The answer is ";
int num = 42;
DTString = DTString + num;
System.out.println( DTString );
As well, coding terms that appear within the main text have been set in a special font for easier reference, like so: "The Java language eliminates this difficulty by extending the capabilities of the continue and break statements."
Icons Oftentimes, there is information that deserves special attention because it highlights a particularly useful or important point that might otherwise get lost among all of the other important information in the main text. For this reason, a number of special icons have been created to help this information stand out. These icons are as follows:
This convention highlights information such as an interesting fact about the topic at hand or an important point to keep in mind when using this book.
This convention is used to help useful information stand out for easier reference. Such information might be a pointer to save you time, a particularly useful technique, or just some good old-fashioned programming advice.
This convention is used to flag information that could save you lots of serious frustration in the long run.
About the CD
Several useful tools and programming examples are provided on the CD-ROM enclosed with the book. The tools are as follows:
- The Java JDK, complete with JDBC and this JDBC-ODBC bridge.
- INTERSOLV DataDirect ODBC Pack for Windows 95/Windows NT.
- The OpenLink Data Access Driver Suite.
Also provided are the majority of the programming examples used in this book. Wherever a program is referenced with a program name, that program is available on the CD-ROM. A special Web page has been created as a front-end to navigating the CD-ROM included with this book. To access that Web page, please load the file named index.html, found in the root directory of the CD-ROM, into your browser. The directory locations of the programs and instructions on running the various applications are accessible from this Web page. Also included on this Web page are links to various JDBC-related sites, as well as the online supplement to this book, explained in the following section.
The combination of the JDBC-ODBC bridge and the Intersolv DataDirect ODBC drivers allow JDBC applications to be developed under the Windows 95 environment.
The OpenLink Data Access Driver Suite provides a complete set of drivers for database connectivity using a number of different standards, including ODBC, JDBC, and Universal Database Connectivity (UDBC). The suite may be used with either multitier or single-tier drivers. All OpenLink drivers are provided on the CD for evaluation.
About the Web Site
Finally, this and every book in the Developer's Resource Series is accompanied by a special online Web supplement created especially for each book. You can look for additional information related to the JDBC, as well as other books in the series, at: www.prenhall.com/developers_resource_series
Additionally, you can link to the online Web supplement directly from the Web page included on the CD-ROM accompanying this book.
Changes to JDBC for JDK 1.1
With the release of version 1.1 of the JDK, JDBC will be part of the core Java API. As part of this merge effort, several minor changes have been made to JDBC. These changes are not, unfortunately, backward compatible. They are as follows:
- The java.sql.Numeric class has been superseded by java.math.BigDecimal.
- The Connection class auto close mode has been removed from JDBC. This has the impact of removing the setAutoClose and getAutoClose methods from the Connection class.
Acknowledgments
I would like to acknowledge the contributions of Shekhar Kirani, for a perceptive technical review; and Mark Hapner at SunSoft, for consistently speedy responses to my technical queries.
Customer Reviews
Average Review: