Weekend Special Offer - Upto 50% Off | OFFER ENDING IN: 0 D 0 H 0 M 0 S

Log In to start Learning

Login via

  • Home
  • Blog
  • How JDBC(Java Database Conn...
Post By Admin Last Updated At 2020-06-11
How JDBC(Java Database Connectivity) Work?

Java DataBase Connectivity

It is an API(Application Program Interface), interacts with Oracle, SQL Server, and My SQL. We can use ODBC for Communicating with Java Program, to a database but, it is not suitable for direct use.Generally, After Completing code in any project, We need to connect data to databases. It is a difficult task. JDBC(Java Database Connectivity) is used to connect, Java applications with Database.

Because it is a C interface. With JDBC we can overcome this problem. This model came after ODBC, but JDBC is more convenient and useful. Especially, It offers a pure interface for working with a database.

How JDBC(Java Database Connectivity) Work?

We have  4 types of JDBC Drivers.Thin Driver.Network Protocol DriverNative Driver.JDBC-ODBC Bridge Driver.JDBC API is used for accessing Tabular Data, that Stored in Relational Database.  With JDBC, we can Save, Delete, update, and Fetch Data from Databases.Why Use JDBC but not ODBC?Before JDBC, we have ODBC API, it is the database API Used to Execute, and Connect Query with Database. It uses Driver, which is written in C language. For this Reason, Java Designed its Own API, which uses JDBC Drivers.We use JDBC API for managing Database, with Java Program and, it can perform the below Activities.It retrieves the output from the database.It Executes Queries and Update Statements to Database.Connect to Database.JDBC is based on X/Open SQL, call Level Interface. Java SQL package has Classes and Interfaces for JDBC API. Popular Interfaces of JDBC are.Row Set Interface.Database Metadata Interface.ResultSet Meta Data Interface.ResultSet interface.Callable Statement Interface.Prepared Statement Interface.Statement Interface.Connection Interface.Driver Interface.

We can use JDBC API, to handle the following activities.

Connect Java program to a Database.

Execute queries and update statements to the database.

Watching and Modify the Output records.

Creating SQL or MySQL claims.

Actually, it was JDBC developed by Sun Microsoft, now a part of Oracle. With JDBC we can access different types, of databases and run any platform. By using JDBC we can write an application, that can send SQL statements to various databases.

For accessing relational database SQL is a standard language.

API(Application Programming Language):

It contains all descriptions and features, regarding software or product. It represents interfaces and classes regarding, software programs and follows, to communicate with each other.

The purpose to create API is store libraries, applications, and operating systems.

Normally, It is a recognition to supply, all interfaces that, which allow portable access.

Java Applications

Applets.

Java server pages

Enterprise Java Beans.

JDBC makes it impossible to possible, to connect the database, which can send queries and statements.

We can say with JDBC, the connection between a database and a Java application is very easy. Finally, the result will be clear and no risks. Similarly, the below figure shows the components of the JDBC model.How JDBC(Java Database Connectivity) Work

Actually, the process is like, Java application calls JDBC to submit statements, and get the results. As per the above figure, JDBC API is an implementation of a JDBC driver.

JDBC interfaces also implemented by JDBC. It drives to calls and returns values. Initially, JDBC is a set of classes, that implement interfaces. Finally, the database stores value coming, from the application by using JDBC Driver.

The following shows that the main objectives of JDBC API:

Data-source

A Data-source object, which used to connect, databases to applications. It is the best method for connection.

A Connection object, which controls a connection to a database. By using this object, an application can alter connections of behavior. With this connection object, an application can create statements.

A ResultSet object, which contains results regarding the query.

We have Many Languages, but using Java was not reduced. It is a basic language for every technology. In addition, Having knowledge of Java is more useful.

Because, it is a platform for all technologies but, learning entire Java is somewhat difficult. Java is Used to program web applications.

If we understand core concepts like collections, OOPS, and libraries, these are sufficient to build games. Mostly, Android developers using this language for developing mobile applications like Java Online Course.

These are the best-known facts, about How JDBC(Java Database Connectivity) Works.