Fiz o codigo conforme o exercício, porem está dando os seguntes erros:
Type mismatch: cannot convert from java.sql.Statement to org.hsqldb.StatementThe method getResultSet() is undefined for the type StatementThe method execute(Session) in the type Statement is not applicable for the arguments (String)The method close() is undefined for the type Statement
Alguem poderia me ajudar?
package br.com.caelum.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.hsqldb.Statement;
public class TestaListagem {
public static void main(String[] args) throws SQLException {
Connection connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/loja-virtual", "SA", "");
Statement statement = connection.createStatement();
boolean resultado = statement.execute("select * from Produto");
ResultSet resultSet = statement.getResultSet();
while(resultSet.next()) {
int id = resultSet.getInt("id");
String nome = resultSet.getString("nome");
String descricao = resultSet.getString("descricao");
System.out.println(id);
System.out.println(nome);
System.out.println(descricao);
}
resultSet.close();
statement.close();
connection.close();
}
}