Statement Interface In JDBC
- The Statement interface is used to execute the normal SQL statement to update or query the database.
- A Statement interface object sends the required SQL statement as a query and then returns a set of results.
- The Statement interface object is associated with Connection object.
- The Statement object submits the SQL statement to database.
- The database compiles the given SQL statement.
- Then an execution plan is prepared by the database to execute the SQL statement.
- The execution plan for the compiled SQL statement is then executed.
- The executeXXX() method is called on Statement object with SQL statement.
- The results are sent to the Statement object.
- Finally the response is sent to the Java application in the form of ResultSet.
Let's see a program to insert a row using Statement interface:
public static void main(String args) throws SQLException,ClassNotFoundException
String s="insert into employee values(102,'Tapaswini',30000)";
System.out.println(i+"row is inserted");
1 row is inserted
Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects
SILAN Technology, BBSR Call to: 9439202111 | 9658317757 | 0674-2361252