Home

This Chapter
-Chapter 22: Java Database Connectivity
-Introduction to JDBC
-Four Steps to Data Access
-Reading Metadata
-The SQLTool Example
-Summary
-Questions

Table of Contents
-Introduction
-Chapter 1: Your First Taste of Java
-Chapter 2: Language Fundamentals
-Chapter 3: Statements
-Chapter 4: Objects and Classes
-Chapter 5: Core Classes
-Chapter 6: Inheritance
-Chapter 7: Error Handling
-Chapter 8: Numbers and Dates
-Chapter 9: Interfaces and Abstract Classes
-Chapter 10: Enums
-Chapter 11: The Collections Framework
-Chapter 12: Generics
-Chapter 13: Input Output
-Chapter 14: Nested and Inner Classes
-Chapter 15: Swing Basics
-Chapter 16: Swinging Higher
-Chapter 17: Polymorphism
-Chapter 18: Annotations
-Chapter 19: Internationalization
-Chapter 20: Applets
-Chapter 21: Java Networking
-Chapter 22: Java Database Connectivity
-Chapter 23: Java Threads
-Chapter 24: Security
-Chapter 25: Java Web Applications
-Chapter 26: JavaServer Pages
-Chapter 27: Javadoc
-Chapter 28: Application Deployment
-Appendix A: javac
-Appendix B: java
-Appendix C: jar
-Appendix D: NetBeans
-Appendix E: Eclipse

Previous
Next

 

Chapter 22

Java Database Connectivity

Even though Java is an object-oriented programming language, data and object state are commonly stored in relational databases. Accessing the database and manipulating data in it therefore is a very important topic of discussion.

There are many brands of databases. To name a few: Oracle, Sybase, Microsoft SQL Server, Microsoft Access, PostgreSQL, and MySQL. Every database server allows access through a proprietary protocol. As such, accessing different databases require different skills. Fortunately for Java programmers, Java Database Connectivity (JDBC) is available to enable easy database and data manipulation. JDBC provides a uniform way of accessing different databases. http://java.sun.com/products/jdbc/index.html is the official Web site for the JDBC technology.

Java 5 includes the version 3.0 of the JDBC. At the time of writing version 4.0 was in the making. The JDBC Application Programming Interface (API) has two parts: the JDBC Core API and the JDBC Optional Package API. The Core part is good for basic database programming, such as creating tables, retrieving data from single and multiple tables, storing data in a table, updating and deleting data, and others. The classes and interfaces in the Core part are members of the java.sql package. The JDBC Optional Package API is specified in the javax.sql package and supports advanced features such as connection pooling, support for Java Naming and Directory Interface (JNDI), distributed transactions, etc. This book only deals with the Core part.

Note

The discussion of JDBC in this book assumes you have basic knowledge of SQL.

Previous
Next