Question - Explain Basic Steps In Writing A Java Program Using Jdbc?
Answer -
JDBC makes the interaction with RDBMS simple and intuitive. When a Java application needs to access database :
- Load the RDBMS specific JDBC driver because this driver actually communicates with the database (Incase of JDBC 4.0 this is automatically loaded).
- Open the connection to database which is then used to send SQL statements and get results back.
- Create JDBC Statement object. This object contains SQL query.
- Execute statement which returns resultset(s). ResultSet contains the tuples of database table as a result of SQL query.
- Process the result set.
- Close the connection.