by Dinesh Thakur Category: JDBC

The Connection interface helps to establish a connection with the required database. Other than establishing connection, it provides lot of functionality including transaction management, maintaining database sessions and creating SQL statements.

Some of the commonly used methods of connection interface are as follows.

• void close(): This method closes database connection associated with Connection's object and releases JDBC resources.

• Statement createStatement(): This method creates a Statement object which is used to send SQL statement to the database. It is usually used when SQL statement without parameters is to be executed.

• CallableStatement prepareCall (String sql): This method creates an instance of CallableStatement which is used to handle database stored procedures.

• PreparedStatement prepareStatement (String sql): This method creates PreparedStatement object which is used to create SQL statement specified in string sql. It is usually used when parameterized SQL statement is to be executed.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.