The Statement interface provides methods to execute queries with the database. The statement interface is a factory of ResultSet i.e. it provides factory method to get the object of ResultSet.
Commonly used methods of Statement interface:
- public ResultSet executeQuery(String sql): is used to execute SELECT query. It returns the object of ResultSet.
- public int executeUpdate(String sql): is used to execute specified query, it may be create, drop, insert, update, delete etc.
- public boolean execute(String sql): is used to execute queries that may return multiple results.
- public int[] executeBatch(): is used to execute batch of commands.
For example of statement interface follow below links:
- 5 JDBC Steps to Connect with Database
- JDBC Connection with MySQL Database
- JDBC: Connection With Oracle Database
See Also :
More on JDBC
Follow below links to learn more on JDBC and solving JDBC related issues :
You must log in to post a comment.