- A Connection object can create Statement objects
Statement stat = conn.createStatement();
- The execute method of the Statement class executes a SQL
statement
stat.execute("CREATE TABLE Test (Name CHAR(20))");
stat.execute("INSERT INTO Test VALUES ('Romeo')");
- Use executeQuery method of the Statement class to issue a query
String query = "SELECT * FROM Test";
ResultSet result = stat.executeQuery(query);
- The result of a SQL query is returned in a ResultSet object