Most of the projects require connecting to a database, the basic steps involved in connecting to a database using JDBC are:
- Loading the appropriate driver,
- Establishing a connection to the database,
- Executing the SQL queries using objects of Statement, PreparedStatement, etc., and
- Using the ResultSet object and closing the connection.
All these steps excluding the first step appears to have some purpose and can be understood intuitively. Loading of the driver can be explained as the process of loading the driver class into the memory for using its functionality during the execution process.
The different ways by which we can load a JDBC driver are illustrated:
