JDBC : Connection to databases

12:11 AM 3 Comments A+ a-

What is JDBC?

JDBC is an API that encapsulates the low−level calls needed for database access and interaction into one common interface. Both the Java Development Kit (JDK) and Java Runtime Environment (JRE) contain the API as part of the standard distribution. The API’s interfaces and classes reside in the java.sql and javax.sql packages. The standard components are packaged in java.sql while the enterprise elements are in javax.sql.

Steps for building a simple JDBC application

1. Import Packages
2. Register JDBC Driver
3. Open a Connection
4. Execute a Query
5. Extract data from Result Set
6. Clean-Up Environment

A Simple Program to demonstrate the JDBC application working: