Java JDBC Tutorial

JDBC tutorial provides basic and advanced concepts of JDBC. Our JDBC tutorial is designed for beginners and professionals.

JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

The JDBC library includes APIs for each of the tasks commonly associated with database usage:

  1. Making a connection to a database
  2. Creating Oracle or MySQL statements
  3. Executing that Oracle or MySQL queries in the database
  4. Viewing & Modifying the resulting records

JDBC is a Java API that is used to connect and execute query to the database. JDBC API uses jdbc drivers to connects to the database.

JDBCAPI

Why use JDBC

Before JDBC, ODBC API was the database API to connect and execute query with the database. But, ODBC API uses ODBC driver which is written in C language (i.e. platform dependent and unsecured). That is why Java has defined its own API (JDBC API) that uses JDBC drivers (written in Java language).


JDBC Interview Questions
  • How to connect Java application with Oracle and Mysql database using JDBC?
  • What is the difference between Statement and PreparedStatement interface?
  • How to print total numbers of tables and views of a database using JDBC ?
  • How to store and retrieve images from Oracle database using JDBC?
  • How to store and retrieve files from Oracle database using JDBC?

Users of RDBMS package can be divided in to 2 categories

  1. Human User
  2. Application

A database vendor provide interface for human user as well as application in his RDBMS package.

Interface of an application represents a set of functions which are defines by the data base vendors in the native technology of the database. Using a native driver in an application for interacting with an RDBMS package has following problems-

When the concept of database a merge different interface are provide for human user and application.


Limits of Model 1:-

  • for each RDBMS package for different api is required.
  • In case RDBMS package change in application need to be modified.

Solution of these problems is provided by ODBC. ODBC ( open database connectivity) is a set of c functions prototype , implementation of these is provided by database vendors.

What is API

API (Application programming interface) is a document that contains description of all the features of a product. It represents classes and interfaces that software programs can follow to communicate with each other. An API can be created for applications, libraries, etc

Topics in Java JDBC Tutorial