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

时间:2022-09-02 19:15:21

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. kali 更改root密码

    sudo root passwd root 然后输入两次密码即可

  2. CSS 仿Excel表格功能

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. 轻松学习 red5 教程 像视频一样很详细还有代码直接可Copy

    转载自:http://blog.csdn.net/hongdianking/archive/2009/11/12/4804339.aspx 最近要做一个流媒体服务器,在网上逗留了好久决定选择 red5 ...

  4. UWP textbox 只能输入数字

    private void Testbox_TextChanged(object sender, TextChangedEventArgs e) {    var textbox = (TextBox) ...

  5. HDOJ 2052 Picture

    Problem Description Give you the width and height of the rectangle,darw it. Input Input contains a n ...

  6. 【转】【C&sol;C&plus;&plus;】内存分配函数:malloc,calloc,realloc&comma;&lowbar;alloca

    转自:http://www.cnblogs.com/particle/archive/2012/09/01/2667034.html#commentform malloc: 原型:extern voi ...

  7. C&num; using垃圾回收详解

    简介 定义一个范围,将在此范围之外释放一个或多个对象. 语法 using (Font font1 = new Font("Arial", 10.0f)) { } C# 语言参考 主 ...

  8. HTTP与HTTPS介绍

    文章大纲 一.HTTP和HTTPS的基本概念二.HTTP缺点三.HTTPS介绍四.免费HTTPS证书推荐   一.HTTP和HTTPS的基本概念 HTTP:是互联网上应用最为广泛的一种网络协议,是一个 ...

  9. ODI Scenario 场景

    ODI中,场景的作用类似发布版本,当映射最终修改版完成时,可以生成场景.无论是映射(Mapping)还是包(Package)都可以生成场景. 包调用映射和调用场景的区别: 1,包直接调用映射,当映射修 ...

  10. Map和String类型之间的转换

    前提是String的格式是map或json类型的 public static void main(String[] args) { Map<String,Object> map = new ...