java tutorial - jdbc statement | Statement interface - java programming - learn java - java basics - java for beginners
- Statement interface provides methods to execute queries with a database.
- It gives factory method to get the object of ResultSet.
Methods of Statement interface:
|public ResultSet executeQuery(String sql)||It is used to execute SELECT query. It returns the object of ResultSet.|
|public int executeUpdate(String sql)||It is used to execute specified query, it can be create, drop, insert, update, delete and so on.|
|public boolean execute(String sql)||It is used to execute queries that may return multiple results.|
|public int executeBatch()||It is used to execute batch of commands.|
- The above sample code compile we are using the code is,