Categories: Java

JDBC API(java.sql Package)

The Java Database Connectivity (JDBC) API allows Java programmers to access data from any database. You can use the JDBC API to access almost any data source, from relational databases to spreadsheets and flat files. JDBC technology also provides a common foundation for the development of tools and alternate interfaces.

Packages of JDBC API:

The JDBC API is divided into two packages:

  • java.sql
  • javax.sql
java.sql package:

The java.sql package provides an API for using the Java programming language to access and process data stored in a data source (typically a relational database). This API includes a framework for dynamically installing different drivers to access various data sources.

Important classes & interfaces of java.sql:
classes/interfaceDescription
java.sql.BLOBAn SQL BLOB(Binary Large Object) value’s representation (mapping) in the Java programming language.
java.sql.Connectioncreates a connection (session) with a specific database.
java.sql.CallableStatementExecute stored procedures
java.sql.CLOBProvide the mapping in the Java programming language for the SQL CLOB (Character Large Object) type.
java.sql.DateProvide support for Date SQL type.
java.sql.Drivercreate the interface that every driver class must implement.
java.sql.DriverManagerProvides the basic service for managing a set of JDBC drivers.
java.sql.PreparedStatementUsed to create and execute parameterized queries.
java.sql.ResultSetIt is an interface that provides methods to access the result row-by-row.
java.sql.Savepointspecify the representation of a savepoint, which is a point within the current transaction that can be referenced from the Connection.rollback method.
java.sql.SQLExceptionEncapsulate all JDBC-related exceptions and provides information on a database access error or other errors.
java.sql.StatementThis interface is used to execute SQL statements.
DatabaseMetaDataIn-depth information about the database as a whole.
DriverActionWhen a Driver needs to be notified by DriverManager, this interface must be implemented.
ResultSetMetaDataAn object that can be used to get information about the types and properties of the columns in a ResultSet object.
RowIdThe representation (mapping) in the Java programming language of an SQL ROWID value.
SQLDataThe interface is used to create a custom mapping from a SQL user-defined type (UDT) to a Java class.
SQLInputAn input stream containing a stream of values representing an instance of a SQL structured type or a SQL distinct type.
SQLOutputThe output stream for writing user-defined type attributes back to the database.
SQLTypeAn object that identifies a generic SQL type, also known as a JDBC type or a vendor-specific data type.
SQLXMLThe mapping in the JavaTM programming language for the SQL XML type.
StatementThe object is used for executing a static SQL statement and returning the results it produces.
StructThe standard mapping in the Java programming language for an SQL structured type.
WrapperInterface for JDBC classes which provide the ability to retrieve the delegate instance when the instance in question is a proxy class.
javax.sql package:

This package provides an API for accessing and processing server-side data sources from the Java programming language.

Important classes & interfaces of javax.sql:
classes/interfaceDescription
javax.sql.ConnectionEventAn Event object that provides information about the source of a connection-related event.
javax.sql.ConnectionEventListenerAn object that registers to be notified of events generated by a PooledConnection object.
javax.sql.DataSourceprovides a connection factory for the physical data source represented by this DataSource object.
javax.sql.PooledConnectionprovide objects to manage connection pools.
CommonDataSourceThis interface defines the methods that are shared by DataSource, XADataSource, and ConnectionPoolDataSource.
RowSetThe interface that adds support to the JDBC API for the JavaBeans™ component model.
RowSetInternalA RowSet object implements this interface in order to present itself to a RowSetReader or RowSetWriter object.
RowSetListenerAn interface that must be implemented by any component that wishes to be notified when a significant event occurs during the lifetime of a RowSet object.
RowSetMetaDataA RowSet object that contains information about the columns.
RowSetReaderThe method used by a disconnected RowSet object to populate itself with rows of data.
RowSetWriterA writer is an object that implements the RowSetWriter interface.
StatementEventListenerAn object that registers to receive notifications when events occur on PreparedStatements in the Statement pool.
XAConnectionAn object that supports distributed transactions.
XADataSourceInternally used factory for XAConnection objects.

Note: also read about the What is JDBC?

Follow Me

If you like my post, please follow me to read my latest post on programming and technology.

https://www.instagram.com/coderz.py/

https://www.facebook.com/coderz.py

Share
Published by
Rabecca Fatima

Recent Posts

Square Root of Integer

Given an integer A. Compute and return the square root of A. If A is…

1 year ago

Build Array From Permutation

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…

1 year ago

DSA: Heap

A heap is a specialized tree-based data structure that satisfies the heap property. It is…

1 year ago

DSA: Trie

What is a Trie in DSA? A trie, often known as a prefix tree, is…

1 year ago

Trees: Lowest Common Ancestor

What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…

1 year ago

Binary Search Tree (BST)

A Binary Search Tree (BST) is a type of binary tree that satisfies the following…

1 year ago