Java 您的SQL语法有错误;检查与MySQL服务器对应的手册
我收到这个错误:Java 您的SQL语法有错误;检查与MySQL服务器对应的手册,java,mysql,Java,Mysql,我收到这个错误: 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 ') ON DUPLICATE KEY UPDATE FIRSTIP='83.242.83.19
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 ') ON DUPLICATE KEY UPDATE FIRSTIP='83.242.83.190',IP='83.242.83.190',MUTE='0',MU' at line 1
我的代码:
sb.append("INSERT INTO `TOOLS_USERS` VALUES(");
sb.append("'%name%',");
sb.append("'%firstip%',");
sb.append("'%ip%',");
sb.append("%mute%,");
sb.append("%mutereason%,");
sb.append("TIME=%time%,");
sb.append(") ON DUPLICATE KEY UPDATE ");
sb.append("FIRSTIP='%firstip%',");
sb.append("IP='%ip%',");
sb.append("MUTE=%mute%,");
sb.append("MUTEREASON=%mutereason%;");
已尝试“%mutereason%”;但是仍然不起作用,同样的错误是:v
有什么想法吗D您有一个错误的逗号
TIME=%TIME%
sb.append("INSERT INTO `TOOLS_USERS` VALUES(");
sb.append("'%name%',");
sb.append("'%firstip%',");
sb.append("'%ip%',");
sb.append("%mute%,");
sb.append("%mutereason%,");
sb.append("TIME=%time%**,**"); <- The error is the following comma. Try to erase it and compile again.
sb.append(") ON DUPLICATE KEY UPDATE ");
sb.append("FIRSTIP='%firstip%',");
sb.append("IP='%ip%',");
sb.append("MUTE=%mute%,");
sb.append("MUTEREASON=%mutereason%;");
sb.append("INSERT INTO `TOOLS_USERS` VALUES(");
sb.append("'%name%',");
sb.append("'%firstip%',");
sb.append("'%ip%',");
sb.append("%mute%,");
sb.append("%mutereason%,");
sb.append("TIME=%time%");
sb.append(") ON DUPLICATE KEY UPDATE ");
sb.append("FIRSTIP='%firstip%',");
sb.append("IP='%ip%',");
sb.append("MUTE=%mute%,");
sb.append("MUTEREASON=%mutereason%;");