JDBC 3.0 - Java Database Connectivity

JDBC 3.0—Java Database Connectivity

Bernard Van Haecke

Published by M&T Books An imprint of Hungry Minds, Inc. 909 Third Avenue New York, NY 10022 www.hungryminds.com

Copyright © 2002 Hungry Minds, Inc. All rights reserved. No part of this book, including interior design, cover design, and icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording, or otherwise) without the prior written permission of the publisher.

Library of Congress Control Number: 2001092927

ISBN: 0-7645-4875-1

10 9 8 7 6 5 4 3 2 1

1B/RV/QR/QS/IN

Distributed in the United States by Hungry Minds, Inc.

Distributed by CDG Books Canada Inc. for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG Norge Books for Norway; by IDG Sweden Books for Sweden; by IDG Books Australia Publishing Corporation Pty. Ltd. for Australia and New Zealand; by TransQuest Publishers Pte Ltd. for Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by Gotop Information Inc. for Taiwan; by ICG Muse, Inc. for Japan; by Intersoft for South Africa; by Eyrolles for France; by International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R. Ltda. for Peru; by WS Computer Publishing Corporation, Inc., for the Philippines; by Contemporanea de Ediciones for Venezuela; by Express Computer Distributors for the Caribbean and West Indies; by Micronesia Media Distributor, Inc. for Micronesia; by Chips Computadoras S.A. de C.V. for Mexico; by Editorial Norma de Panama S.A. for Panama; by American Bookshops for Finland.

For general information on Hungry Minds’ products and services please contact our Customer Care department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993 or fax 317-572-4002.

For sales inquiries and reseller information, including discounts, premium and bulk quantity sales, and foreign-language translations, please contact our Customer Care department at 800-434-3422, fax 317-572-4002 or write to Hungry Minds, Inc., Attn: Customer Care Department, 10475 Crosspoint Boulevard, Indianapolis, IN 46256.

For information on licensing foreign or domestic rights, please contact our Sub-Rights Customer Care department at 212-884-5000.

For information on using Hungry Minds’ products and services in the classroom or for ordering examination copies, please contact our Educational Sales department at 800-434-2086 or fax 317-572-4005.

For press review copies, author interviews, or other publicity information, please contact our Public Relations department at 317-572-3168 or fax 317-572-4168.

For authorization to photocopy items for corporate, personal, or educational use, please contact Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, or fax 978-750-4470.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK. THE PUBLISHER AND AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THERE ARE NO WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS PARAGRAPH. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ACCURACY AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE OPINIONS STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS, AND THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL. NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES.

Trademarks: Hungry Minds, the Hungry Minds logo, M&T Books, the M&T Books logo, and Professional Mindware are trademarks or registered trademarks of Hungry Minds, Inc. in the United States and other countries and may not be used without written permission. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the U.S. and other countries. All other trademarks are the property of their respective owners. Hungry Minds, Inc., is not associated with any product or vendor mentioned in this book.

About the Author

Bernard Van Haecke leads the Sun Java Center in Belgium and Luxembourg, a Sun Professional Services consulting practice where he helps customers build and implement complex software applications based on Java and J2EE. He focused on Java since the day it was made publicly available by Sun in May 1995 and started writing one of the first books on JDBC for IDG Books Worldwide (now Hungry Minds) the next year. He then leveraged many of the new APIs, including enterprise APIs, in customer projects for more than half a decade, which led to the development of an avant-garde E-banking and E-trading system in 1997, the re-architecture of IT environments in financial institutions centered on new paradigms, the realization of numerous Java pilots in various fields of the industry, and several coaching and mentoring missions.

Credits

Senior Acquisitions Editor
Grace Buechlein

Senior Project Editor
Jodi Jensen

Development Editor
Dana Lesh

Technical Editor
Ashutosh Bhonsle

Copy Editors
Dana Lesh and Sara Shlaer

Editorial Manager
Mary Beth Wakefield

Senior Vice President, Technical Publishing
Richard Swadley

Vice President and Publisher
Joseph B. Wikert

Project Coordinator
Regina Snyder

Graphics and Production Specialists
Melanie DesJardins
Joyce Haughey
LeAndra Johnson
Jill Piscitelli
Betty Schulte
Jeremey Unger

Quality Control Technician
Andy Hollandbeck
Susan Moritz

Proofreader
Christine Sabooni

Indexing
TECHBOOKS Production Services

Cover Image
© Noma/Images.com

Acknowledgments

Among the many individuals who helped with this project, I first want to thank my family and friends who brought me their continued support for a long time. I thank very sincerely everyone who played an instrumental role before and during the writing of this edition and those who were key to the first edition. Special thanks to Dana Lesh who, as development editor and copy editor, played a key role in enhancing the manuscript in such a great way and in making it much more readable!

Thanks to Greg Croy, Hungry Minds acquisitions manager, Grace Buechlein, senior acquisitions editor, Jodi Jensen, my project editor, Sara Shlaer, copy editor, Ashutosh Bhonsle, technical editor, Christy Clinton of acquisitions assistant, Arlene Joy Pilkington, former acquisitions editor, and everyone else involved in the making and publication of the book that you now have in your hands. I am infinitely grateful to you all.

I also want to thank all the great people at Sun who make Java, JDBC, J2EE, Jini, etc. so cool, and all my colleagues who turn these into real successes when designing and building systems for customers. Special thanks to Stu Stern, VP Worldwide Sun Java Centers, and Staffan Calais, manager of Sun Java Centers Northern Europe, for leading these efforts!