I surf the net and don't search what I need. So please you help me. When I try to execute this SQL statement in Eclipse
private final String INSERT_ = "INSERT INTO department VALUES (?, ?, ?)";
I have next error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, ?, ?)' at line 1 This is my code
public void insert(int id, String name, String description) throws SQLException
{
Department result = null;
Connection conn = ConnectionManager.getConnection();
PreparedStatement stmt = conn.prepareStatement(INSERT_);
stmt.setInt(1, id);
stmt.setString(2, name);
stmt.setString(3, description);
stmt.executeUpdate(INSERT_);
System.out.println("Record is inserted into table!");
}
Thanks in advance!
I surf the net and don't search what I need.yes, I've noticed that a lot here on SO.