com.mysql.jdbc.exceptions.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 ') values( '林�沂','150207333','女','1997-12-04','13879793456')' at line 1
报错内容说明出现了一堆乱码,而我确实用了request.setCharacterEncoding("utf-8"),但是还是乱码。
我输出了发现并没有乱码。搜了一下错误解决方法,得到的是sql语句有问题。
String sql=""+
" insert into stud_test"+
" (name,id,sex,birth,phone_number,)"+
" values("+
" ?,?,?,?,?)";
果然多了一个逗号,删掉保存运行,果然没错了。