The JDBC SQL classes and interfaces remain in two Java packages : java.sql and javax.sql:
java.sql:- This package contains classes and interfaces designed with traditional client-server architecture in mind. Its functionality is focused primarily on basic database programming services such as creating connections, executing statements and prepared statements, and running batch queries. Advanced functions such as batch updates, scrollable resultsets, transaction isolation, and SQL data types are also available.
javax.sql :- This package introduces some major architectural changes to JDBC programming compared to java.sql, and provides better abstractions for connection management, distributed transactions, and legacy connectivity. This package also introduces container-managed connection pooling, distributed transactions, and rowsets.
The classes in the java.sql package can be divided into the following groups based on their functionality:
Connection Management :- The following classes/interfaces let you establish a connection to the database. In most cases, this involves a network connection:
The java.sql.PreparedStatement and java.sql.CallableStatement extend java.sql.Statement. All the three interfaces are conceptually similar, each offering a means of sending requests to execute SQL statements and obtaining the results of execution.
Data Types :- The java.sql package also provides several Java data types that correspond to some fo the SQL types. You can use one of the following types as appropriate depending on what a field in a result row corresponds to in the database: java.sql.Array, java.sql.Blob; java.sql.Clob; java.sql.Date; java.sql.Time; java.sql.Tiimestamp; java.sql.Ref; java.sql.Struct; java.sql.Types.
The JDBC API also includes facilities for dealing with custom database types. These types can be represented as java.sql.SQLData objects, and data within these types can be accessed using java.sql.SQLInput and java.sql.Output interfaces that provide a stream like interface to accessing data.
Database Metadata :- The JDBC API also includes facilities to obtain metadata about the database, parameters to statements, and result: java.sql.DatabaseMetadata, java.sql.ResultMetadata, java.sql.ParameterMetadata
Exceptions and Warnings:- The following classes encapsulate database access errors and warnings: java.sql.SQLException, java.sql.SQLWarning, java.sql.BatchUpdateException, java.sql.DataTruncation.