首页 > 数据库技术 > 详细

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxError Exception

时间:2015-02-11 23:22:38      阅读:587      评论:0      收藏:0      [点我收藏+]

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”

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxError Exception

原文:http://blog.csdn.net/you23hai45/article/details/43741639

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!