Me devolve esta exception: Exception in thread "main" java.sql.SQLException: Column count doesn't match value count at row 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at TestaInsercao.main(TestaInsercao.java:16)
Assim esta meu código:
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement;
public class TestaInsercao {
public static void main(String[] args) throws SQLException {
ConnectionFactory factory = new ConnectionFactory();
Connection connection = factory.recuperarConexao();
Statement stm = connection.createStatement();
boolean resultado =
stm.execute("INSERT INTO PRODUTO(nome,descricao)VALUES('MOUSE')");
System.out.println(resultado);
}
}