ch5Database
ch5Database
1
Database and SQL
Grant
4. Query (select) 2
JDBC is an API used to connect Java application with database
Is used to interact with various type of database i.e. Ms Access, MYSQL and SQL
Server
Java Application
JDBC Architecture
JDBC API
JDBC DriverManager
Before JDBC, ODBC API was used to communicate with the databases
Written in c language
Platform dependent
Unsecured
4
JDBC Driver
Is a software component that enables java application to interact with the database .
7
JDBC API
The driver must be loaded before connecting to a database, to locate, load and link the
driver class.
8
The DriverManager class
It keep track the registered drivers connection between the database and the driver
SQL statements are sent to the database for execution and returns the results of the
execution
9
The Statement Interface
executeQuery
ExecuteUpdate
10
The SQL Exception classes
11
1. Register the driver
Class.forName() is used to load the driver
2. Create a connection
getConnection() method of DriverManger class is used to create a connection
13