当前位置:   article > 正文

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxError Exception_com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorex

com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception

1、错误描述

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxError Exception: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 'notnull,user_name varchar(255) )' at line 1


2、错误原因

StringBuilder sql = new StringBuilder();
sql.append("create table t_you_su_ta(");
sql.append(" id int primary key,");
sql.append(" user_id int notnull,");
sql.append(" user_name varchar(255))");

在拼接创建数据库表时,要使user_id不为空,定义成了“notnull”


3、解决办法

   在拼接user_id时,应改成“user_id int not null”

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/700255
推荐阅读
相关标签
  

闽ICP备14008679号