ALTER TABLE esa_matrix ADD INDEX doc_index (id_doc)
So, I've create a PreparedStatement
instance with the same text of the query and perform executeUpdate()
method on it. But at execution time I get a SQL syntax error.
This is creation of the PreparedStatement
instance:
PreparedStatement ps = conn.prepareState开发者_开发问答ment("ALTER TABLE "+ESATable+ "ADD INDEX doc_index ("+idDocLabel+")");
ps.executeUpdate();
ps.close();
This SQLException I get:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'doc_index (id_doc)' at line 1
How can I solve this?
Thanks in advance, AntonioYou've forgotten a space before the "ADD".
精彩评论