JDBC is a set of programming APIs that allows easy connection to a wide range of databases(especially relational databases) through Java programs. In this book, we will be using JDBC 2.0 and 3.0 versions(JDBC 4.0 is just a specification and has not been implemented extensively yet.) In Java 2 Platform Standard Edition (J2SE) 5.0 (which supports JDBC 3.0), the JDBC API is defined by two packages:
java.sql provides the API for accessing and processing data stored in a data source(usually a relational database) using the Java programming language. This package provides the foundation and most commonly used objects(such as Connection, ResultSet, Statement, and PreparedStatement). Also, this package provides classes and interfaces to get both database and result set metadata from the database server. This package has a set of classes and interfaces (such as DatabaseMetaData and ResultSetMetaData) that deal with database metadata, which will be one of the focuses of this book.
javax.sql provides the API for server-side data source access. According to the Java Development Kit(JDK) documentation, “This package supplements the java.sql package and, as of the version 1.4 release, is included in the JDK. It remains an essential part of the Java 2 SDK, Enterprise Edition (J2EE).” This package provides services for J2EE(such as DataSource and RowSets). Also, the package has a set of classes and interfaces(such as RowSetMetaData) that deal with row set metadata. In this book we focus on the metadata components of this package.
In a nutshell, JDBC is a database-independent API for accessing a relational database. You pass SQL to Java methods in the JDBC classes(the packages java.sql and javax.sql) and get back JDBC objects(such as ResultSet, DatabaseMetaData, and ResultSetMetaData) that represent the results of your query. JDBC is designed so simply that most database programmers need learn only a few methods to accomplish most of what they need to do.
Figure shows how a database application(such as a Java application/applet/servlet) uses JDBC to interact with one or more databases.
Java database application using JDBC
Figure presents the basic outline of the JDBC architecture. JDBC’s DriverManager class provides the basic service for managing a set of JDBC drivers. The DriverManager loads JDBC drivers in memory, and can also be used to create java.sql.Connection objects to data sources(such as Oracle and MySQL).
Note that you can have more than one driver and therefore more than one database.
Figure illustrates how a Java application uses JDBC to interact with one or more relational databases(such as Oracle and MySQL) without knowing about the underlying JDBC driver implementations. Figure illustrates the core JDBC classes and interfaces that interact with Java and JDBC applications. This figure also shows the basic relationships of the DatabaseMetaData and ResultSetMetaData interfaces with other JDBC objects.
Using JDBC database metadata
The following are core JDBC classes, interfaces, and exceptions in the java.sql package:
JDBC Related Interview Questions
|Core Java Interview Questions||JSP Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JSTL(JSP Standard Tag Library) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Bean Utils Interview Questions||AWT (Abstract Window Toolkit) Interview Questions|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.