Introduction to JDBC in Java
Java Database Connectivity is a standard Java API used to connect Java application with Database. Java JDBC is used to communicate with the different type of Databases like Oracle, MS Access, My SQL and SQL Server. JDBC can also define as the platform-independent interface between a relational database and Java programming. It allows a java program to execute the SQL statement and retrieve the result from the database. JDBC uses drivers to connect with database.
Different Types of JDBC Driver in Java
There are four types of JDBC Drivers:
1. JDBC-ODBC Bridge Driver
2. Natïve Driver
3. Network Protocol Driver
4. Thin Driver
Why should we use JDBC?
There is some critical point which explains why we should use JDBC.
1. JDBC API is Standard API. We can communicate with any Database without
revising our Application, i.e. it is Database Independent API.
2. JDBC Drivers developed in Java, and hence JDBC Concept is applicable for any
Platform. i.e., JDBC is Platform Independent Technology.
3. By using JDBC API, we can perform basic CRUD Operations very efficiently.
C ➔ Create (Insert)
R ➔ Retrieve (Select)
U ➔ Update (Update)
D ➔ Delete (Delete)
4. We can also perform Complex Operations like inner joins, Outer joins, calling
Stored Procedures, etc. very quickly by using JDBC API.
5. JDBC API supported by many vendors and they developed multiple Products
based on JDBC API.
Advantages of JDBC:
1. Provide present enterprise information.
2. Automatically Creates an XML structure of data from the database.
3. No content conversion required.
4. Query and Stored procedure supported.
5. We can use JDBC for both Synchronous and Asynchronous processing.
6. Supports modules.
7. Zero Configuration for Network Computers.
8. Full Access to Metadata.
9. Database Connection Identified by URL.
10. It does not require an installation.