Experiment No 11 DBMS
Experiment No 11 DBMS
Experiment No 11 DBMS
Definition: JDBC is a Java-based API (Application Programming Interface) that allows Java
applications to interact with relational databases. It provides a standard interface for connecting
Java applications with various database management systems (DBMS) and executing SQL
queries.
Purpose: JDBC facilitates database connectivity, enabling Java applications to perform tasks
such as executing SQL queries, retrieving and updating data, and managing transactions.
ODBC (Open Database Connectivity):
The current version of JDBC is 4.3. It is the stable release since 21st September, 2017. It is
based on the X/Open SQL Call Level Interface. The java.sql package contains classes and
interfaces for JDBC API. A list of popular interfaces of JDBC API are given below:
o Driver interface
o Connection interface
o Statement interface
o PreparedStatement interface
o CallableStatement interface
o ResultSet interface
o ResultSetMetaData interface
o DatabaseMetaData interface
o RowSet interface
A list of popular classes of JDBC API are given below:
o DriverManager class
o Blob class
o Clob class
o Types class
ODBC:
How ODBC works
ODBC consists of four components, working together to enable functions. ODBC allows
programs to use SQL requests that access databases without knowing the proprietary
interfaces to the databases. ODBC handles the SQL request and converts it into a request
each database system understands.
The four different components of ODBC are:
• Application: Processes and calls the ODBC functions and submits the SQL
statements;
• Driver: Handles ODBC function calls, and then submits each SQL request to a
data source; and
• Data source: The data being accessed and its database management system
(DBMS) OS.
OBDC can also work with MySQL when its driver is called MyODBC. Sometimes, this is
referred to as the MySQL Connecter/ODBC.
The Java Database Connectivity (JDBC) API uses the Java programming language to access
a database. When writing programs in the Java language using JDBC APIs, users can employ
software that includes a JDBC-ODBC Bridge to access ODBC-supported databases.
However, the JDBC-ODBC Bridge (or JDBC type 1 driver) should be viewed as a
transitional approach, as it creates performance overhead because API calls must pass
through the JDBC bridge to the ODBC driver, then to the native database connectivity
interface. In addition, it was removed in Java Development Kit (JDK) 8, and Oracle does not
support the JDBC-ODBC Bridge. The use of JDBC drivers provided by database vendors,
rather than the JDBC-ODBC Bridge, is the recommended approach.
Experimental Task:-
Implement Program for JDBC-ODBC connectivity for accessing database:
Conclusion:-
From above experiment, I understood to connect the database to a java program. I
retrieved the database items using java programs.