Java Database Connectivity (JDBC)
2 min readFeb 14, 2021
This article is a part of the Java Programming Language article series.
JDBC
- Java API for database access
- A separate JDBC driver is used for each system
Database
- A collection of data
Table
- Database objects that contains the data
- Has rows and columns
- Rows: records
- Columns: field in the record
Commands
DML (Data Manipulation Language)
- SELECT: Query and display data
- INSERT: Adds new rows
- DELETE: Removes rows
- UPDATE: Changes an existing value
DDL (Data Definition Language)
- CREATE: Creates a table
- DROP: Removes the table
- ALTER: Adds or removes a column or a constraint, and changes column attributes
JDBC Driver
- Libraries for specific database types: Java DB, MySql, Postgre SQL, IBM DB2, Microsoft SQL, Oracle
- Defined in the project
JDBC Process
- Establish the connection
- Send the query
- Process the result
- Error: SQLException
Connection
Creating a Table
Add, update or delete data
Reading the data
Retrieving Column Values from Rows
Prepared Statements
Batch Process
Stored Procedures
- A group of SQL statements that perform a particular task
Create
Call