|
Answer» The java.sql package contains different interfaces and classes for JDBC API. They are:
Interfaces: - Connection: The object of Connection is created by using getConnection() method of DriverManager class. DriverManager is the factory for connection.
- STATEMENT: The object of the Statement is created by using createStatement() method of the Connection class. The Connection interface is the factory for Statement.
- PreparedStatement: The PreparedStatement object is created by using prepareStatement() method of Connection class. It is used for executing the parameterized query.
- ResultSet: The ResultSet object maintains a cursor pointing to a table row. At first, the cursor points before the first row. The executeQuery() method of the Statement interface returns the object of ResultSet.
- ResultSetMetaData: The ResultSetMetaData interface object contains the details about the data(table) such as number of columns, name of the COLUMN, column type etc. The getMetaData() method of ResultSet returns the ResultSetMetaData object.
- DatabaseMetaData: It is an interface that has methods to get metadata of a database, like name of the database product, version of database product, driver name, name of the total number of views, name of the total number of tables, etc. The getMetaData() method that belongs to Connection interface returns the DatabaseMetaData object.
- CallableStatement: CallableStatement interface is useful for calling the stored procedures and FUNCTIONS. We can have business logic on the database through the usage of stored procedures and functions, which will be helpful for the improvement in the performance as these are pre-compiled. The prepareCall() method that belongs to the Connection interface returns the object of CallableStatement.
Classes: - DriverManager: It pretends to be an interface between the user and drivers. DriverManager keeps track of the available drivers and handles establishing a connection between a database and the relevant driver. It contains various methods to keep the interaction between the user and drivers.
- BLOB: BLOB stands for Binary Large Object. It represents a collection of binary data such as images, audio, and video files, etc., which is stored as a SINGLE entity in the DBMS(Database Management System).
- CLOB: CLOB stands for Character Large Object. This data type is used by multiple database management systems to store character files. It is the same as BLOB except for the difference, instead of binary data, CLOB represents character stream data such as character files, etc.
|