servlets struts hibernate spring maven java
 

JDBC - Introduction


What is JDBC?

JDBC represents Java Database Connectivity, which is a standard Java API for database-free availability between the Java programming language and a wide scope of databases.

The JDBC library incorporates APIs for every one of the assignments referenced underneath that are regularly connected with database usage.

  • Making an association with a database.

  • Creating SQL or MySQL statements.

  • Executing SQL or MySQL inquiries in the database.

  • Viewing & Modifying the subsequent records.

Fundamentally, JDBC is a particular that gives a total arrangement of interfaces that takes into account compact access to a basic database. Java can be utilized to compose diverse kinds of executables, for example, −

  • Java Applications

  • Java Applets

  • Java Servlets

  • Java ServerPages (JSPs)

  • Enterprise JavaBeans (EJBs).

All of these diverse executables can utilize a JDBC driver to get to a database, and exploit the put away data.

JDBC gives indistinguishable abilities from ODBC, permitting Java projects to contain database-autonomous code.

JDBC Architecture

The JDBC API underpins both two-level and three-level handling models for database get to however all in all, JDBC Architecture comprises of two layers −

  • JDBC API: This gives the application-to-JDBC Manager connection.

  • JDBC Driver API: This backings the JDBC Manager-to-Driver Connection.

The JDBC API utilizes a driver administrator and database-explicit drivers to give straightforward availability to heterogeneous databases.

The JDBC driver administrator guarantees that the right driver is utilized to get to every datum source. The driver administrator is fit for supporting various simultaneous drivers associated with different heterogeneous databases.

Following is the building chart, which demonstrates the area of the driver chief regarding the JDBC drivers and the Java application −

JDBC Architecture

Common JDBC Components

The JDBC API gives the accompanying interfaces and classes −

  • DriverManager: This class deals with a rundown of database drivers. Matches association demands from the java application with the best possible database driver utilizing correspondence sub convention. The principal driver that perceives a certain subprotocol under JDBC will be utilized to build up a database Connection.

  • Driver: This interface handles the interchanges with the database server. You will interface specifically with Driver questions in all respects infrequently. Rather, you use DriverManager objects, which oversees objects of this sort. It likewise abstracts the subtleties related with working with Driver objects.

  • Connection: This interface with all strategies for reaching a database. The association object speaks to correspondence setting, i.e., all correspondence with database is through association object only.

  • Statement: You use objects made from this interface to present the SQL proclamations to the database. Some inferred interfaces acknowledge parameters notwithstanding executing put away procedures.

  • ResultSet: These items hold information recovered from a database after you execute a SQL question utilizing Statement objects. It goes about as an iterator to enable you to travel through its data.

  • SQLException: This class handles any mistakes that happen in a database application.

The JDBC 4.0 Packages

The java.sql and javax.sql are the essential bundles for JDBC 4.0. This is the most recent JDBC variant at the season of composing this instructional exercise. It offers the primary classes for cooperating with your information sources.

The new highlights in these bundles incorporate changes in the accompanying regions −

  • Automatic database driver loading.

  • Exception dealing with improvements.

  • Enhanced BLOB/CLOB functionality.

  • Connection and explanation interface enhancements.

  • National character set support.

  • SQL ROWID access.

  • SQL 2003 XML information type support.

  • Annotations.






© Javacodegeeks 2019 -
All Right Reserved and you agree to have read and accepted our term and condition.

Python 3