Dá esse erro:
java.sql.SQLException: Syntax error or access violation message from server: “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 ‘Linear’ at line 1”
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)
public boolean incluirProf(String cod, String prof, String codigo)
{
//int codigo = ListarCodDisc(codDisciplina);
try
{
PreparedStatement ps = this.conexao.prepareStatement("insert into Professores(CodProfessor, Nome, CodDisciplina) values(cod,prof,codigo) ");
ps.setInt(1,Integer.parseInt(cod));
ps.setString(2,prof);
ps.setInt(3,Integer.parseInt(codigo));
ps.executeUpdate();
return true;
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Erro inserir professor :"+e);
return false;
}
}