Q1. What are JDBC Statements? What are different types of statements? How can you create them? A1. A statement object is responsible for sending the SQL statements to the Database. Statement objects are created from the connection object and then executed.
|
1 2 3 4 5 |
Statement stmt = myConnection.createStatement(); ResultSet rs = stmt.executeQuery(“SELECT id, name FROM myTable where id =1245”); //to read or stmt.executeUpdate(“INSERT INTO (field1,field2) values (1,3)”); //to insert |
The types of statements are: Statement (regular statement...