Parts of JDBC

JDBC has two parts:

  • JDBC API, which contains a set of classes and interfaces that define access to databases. These classes and methods are declared in two packages - java.sql and javax.sql;
  • JDBC driver, a component specific to each database.

JDBC turns API calls into native commands for a particular database server.

List the main JDBC classes and interfaces

  • java.sql.DriverManager - Lets you download and register the required JDBC driver, and then get a connection to the database.
  • javax.sql.DataSource - solves the same tasks as DriverManager, but in a more convenient and versatile way. There are also javax.sql.ConnectionPoolDataSource and javax.sql.XADataSource whose job it is to provide connection pooling.
  • java.sql.Connection - Provides data source queries and transaction management. The javax.sql.PooledConnection and javax.sql.XAConnection interfaces are also provided.
  • java.sql.Statement, java.sql.PreparedStatement, java.sql.CallableStatement - These interfaces allow you to send a request to the data source.
  • java.sql.ResultSet - declares methods that allow you to navigate the dataset and read the values of individual fields in the current record.
  • java.sql.ResultSetMetaData - allows you to get information about the structure of a dataset.
  • java.sql.DatabaseMetaData - allows you to get information about the structure of the data source.

Read also:


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed