JAVA JDBC Programming Question:
Download Job Interview Questions and Answers PDF
How can you create JDBC statements?
Answer:
A Statement object is what sends your SQL statement to the DBMS. You simply create a Statement object and then execute it, supplying the appropriate execute method with the SQL statement you want to send. For a SELECT statement, the method to use is executeQuery. For statements that create or modify tables, the method to use is executeUpdate. E.g. It takes an instance of an active connection to create a Statement object. In the following example, we use our Connection object con to create the Statement object stmt :
Statement stmt = con.createStatement();
Statement stmt = con.createStatement();
Download JDBC Interview Questions And Answers
PDF
Previous Question | Next Question |
How can you make the connection using JDBC? | How can you retrieve data from the ResultSet using JDBC? |