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的更多相关文章

  1. Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

    我在update数据库的时候出现的死锁 数据库表死锁 Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackExcept ...

  2. 【异常】ERROR main:com.cloudera.enterprise.dbutil.SqlFileRunner: Exception while executing ddl scripts. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ROLES' already exists

    1 详细异常 2019-10-11 10:33:55,865 INFO main:com.cloudera.server.cmf.Main: ============================= ...

  3. bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

    ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL ...

  4. [jnhs]hibernate只能创建一张/表不创建表com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'kaihu.t_client_info' doesn't exist和org.hibernate.exception.SQLGrammarException: could not execute statement

    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'kaihu.t_client_info' doesn't exist ...

  5. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '??????' in 'field list'

    严重: Servlet.service() for servlet jsp threw exceptioncom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErro ...

  6. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

    Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You ...

  7. Oozie时出现Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure?

    不多说,直接上干货! 问题详情 [hadoop@bigdatamaster oozie--cdh5.5.4]$ bin/ooziedb.sh create -sqlfile oozie.sql -ru ...

  8. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zhongfucheng.user' does

    编写第一个Hibernate程序的时候,就发现出现了错误 Exception in thread "main" org.hibernate.exception.SQLGrammar ...

  9. Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Query was empty

    1 错误描写叙述 at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(Invocable ...

随机推荐

  1. ABP官方文档翻译 6.1.3 异常处理

    处理异常 介绍 启用错误处理 Non-Ajax请求 显示异常 UserFriendlyException Error模型 AJAX请求 异常事件 介绍 此文档是与ASP.NET MVC和Web API ...

  2. InnoDB索引

    名词解释 clustered index(聚集索引) 对(primary key)主键索引的一种表述.InnoDB表存储是基于primary key列来组织的,这样做可以加快查询和排序速度.为了获得最 ...

  3. Lua利用cjson读写json

    前言 本文结合本人的实际使用经验和代码示例,介绍如何在Lua中对json进行encode和decode.我这里采用的是Lua CJson库,是一个高性能的JSON解析器和编码器,其性能比纯Lua库要高 ...

  4. Java的一些良好习惯及细节------持续更新中...

    1.在做条件判断时,不要将变量放在判断符的左边,这样做可以防止出现空指针异常,以字符串比较为例: String name = "Tom"; //这种方式不推荐,如果变量name为空 ...

  5. MacbookPro管理员问题

    更改用户名重启之后,发现用户名还是用户名,管理员权限降成了普通用户. 参考这个帖子改的用户名: https://zhidao.baidu.com/question/259845860.html 找回管 ...

  6. 图论算法-网络最大流【EK;Dinic】

    图论算法-网络最大流模板[EK;Dinic] EK模板 每次找出增广后残量网络中的最小残量增加流量 const int inf=1e9; int n,m,s,t; struct node{int v, ...

  7. [HEOI2016]求和 sum

    [HEOI2016]求和 sum 标签: NTT cdq分治 多项式求逆 第二类斯特林数 Description 求\[\sum_{i=0}^n\sum_{j=0}^i S(i,j)×2^j×(j!) ...

  8. PPPoE拨号流程

    PPPoE(Point to Point Protocol over Ethernet,基于以太网的点对点协议)的工作流程包含发现(Discovery)和会话(Session)两个阶段,发现阶段是无状 ...

  9. Hibernate自动生成实体类注解(转)

    常用的hibernate annotation标签如下: @Entity --注释声明该类为持久类.将一个Javabean类声明为一 个实体的数据库表映射类,最好实现序列化.此时,默认情况下,所有的类 ...

  10. 用一个简单的例子比较SVM,MARS以及BRUTO(R语言)

    背景重述 本文是ESL: 12.3 支持向量机和核中表12.2的重现过程.具体问题如下: 在两个类别中产生100个观测值.第一类有4个标准正态独立特征\(X_1,X_2,X_3,X_4\).第二类也有 ...