Wednesday, 30 March 2016

What are basic steps in writing a Java program using JDBC ?


JDBC makes the interaction with RDBMS simple and intuitive.

When a Java application needs to access database :
1. Load the JDBC driver (RDBMS specific) because this driver actually communicates with the database
    In case of JDBC 4.0 this is automatically loaded.
2. Open the connection to database which is then used to send SQL statements and get results back.
3. Create Statement object which contains SQL query.
4. Execute statement which returns resultset (s)
    ResultSet contains the tuples of database table as a result of SQL query.
5. Process the result set.
6. Close the connection.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.