Quick Contact



    Java JDBC

    JDBC stands for Java Database Connectivity. It is a tool or application programming interface to establish the connection between the java programming language and standard databases. JDBC involves opening the connection, creating SQL databases, Executing Queries and view to Output.

    JDBC Architecture

    JDBC Architecture support two tiers and three tiers processing models for database access. It consists of two layers JDBC API and JDBC Drivers. JDBC API provides applications to JDBC manage the connection, and driver API supports the JDBC manager to driver connection. The JDBC API uses a driver manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The driver manager ensures that the correct driver is used to access each data source. It is also capable of supporting multiple concurrent drivers that are connected to multiple heterogeneous databases.

    Java JDBC

    Creating JDBC Application:

    There are the following six steps involved in building a JDBC application:

    • Import the packages-

      Requires that you include the packages containing the JDBC classes needed for database programming. Most often, using import java.sql.* will suffice.

    • Register the JDBC driver-

      Requires that you initialize a driver to open a communications channel with the database.

    • Open a connection¬-

      Requires using the DriverManager.getConnection() method to create a Connection object representing a physical connection with the database.

    • Execute a query-

      Requires using an object of type Statement for building and submitting an SQL statement to the database.

    • Extract data from result set-

      Requires that you use the appropriate ResultSet.getXXX() method to retrieve the data from the result set.

    • Clean up the environment-

      Requires explicitly closing all database resources versus relying on the JVM’s garbage collection.

    Types of JDBC Driver

    We can use three types of JDBC drivers in our Java programs to connect to a Database.

    • JDBC Native API Driver
    • JDBC-Net Driver
    • JDBC Driver
    Java JDBC

    JDBC Native API Driver

    The JDBC-Native API driver uses a Database-specific native library to perform all database activities. It translates JDBC calls into database-specific calls, and the Database native library communicates with the database. We must install database-specific client software to use this type of driver. It is platform-dependent.

    JDBC-Net Driver

    The JDBC-Net driver is written in pure Java. It needs a server to work with a database. The driver translates the JDBC calls into a network protocol and passes the calls to the server. The server decrypts the network calls to database-specific calls. The JDBC driver running at the client machine is unaware of the technology (or DBMS driver types) that the server will use to perform the database activities. The server can use different types of database drivers to connect to other databases, and it will be transparent to the client. It is a platform-independent driver. The client machine needs to include only the Java classes required to use the driver. There is no additional installation required on the client machine.

    JDBC Driver

    The JDBC driver is also known as a direct-to-database pure Java driver. It is written in pure Java. It converts the JDBC calls into Database-specific calls and sends the calls directly to the database. It is the best suitable driver type to be used in applets. All you need to do is include the driver JAR/ZIP files with your application or applet. All major Database vendors supply this type of JDBC driver.

    Apply now for Advanced Java Training Course

    Copyright 1999- Ducat Creative, All rights reserved.

    Anda bisa mendapatkan server slot online resmi dan terpercaya tentu saja di sini. Sebagai salah satu provider yang menyediakan banyak pilihan permainan.