Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么我会得到一个“;MySQLSyntaxErrorException:“;错误?_Java_Mysql_Sql_Syntax - Fatal编程技术网

Java 为什么我会得到一个“;MySQLSyntaxErrorException:“;错误?

Java 为什么我会得到一个“;MySQLSyntaxErrorException:“;错误?,java,mysql,sql,syntax,Java,Mysql,Sql,Syntax,语法错误,我似乎找不到它。我不熟悉数据库 错误: com.mysql.jdbc.exceptions.jdbc4.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 'database ( ID INTEGER NOT NULL,

语法错误,我似乎找不到它。我不熟悉数据库

错误:

com.mysql.jdbc.exceptions.jdbc4.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 'database ( ID INTEGER NOT NULL, QUESTION varchar(100) NOT NULL, ANSWER varchar(5' at line 1
代码:


数据库
是一个。为表使用不同的名称

数据库
是一个数据库。为表使用不同的名称

数据库
是一个数据库。为表使用不同的名称

数据库
是一个数据库。为表使用其他名称

数据库
是保留字。给你的桌子起个别的名字<代码>数据库是保留字。给你的桌子起个别的名字<代码>数据库是保留字。给你的桌子起个别的名字<代码>数据库是保留字。给你的桌子起个别的名字。
public void createTable(Connection conn) {
    try {
        String createString = "CREATE TABLE " + this.tableName + " ( "
                + "ID INTEGER NOT NULL, "
                + "QUESTION varchar(100) NOT NULL, "
                + "ANSWER varchar(500) NOT NULL, " + "PRIMARY KEY (ID))";

        this.sendUpdate(conn, createString); //This part definitely works as intended
        System.out.println("Created a table called " + this.tableName);
    } catch (SQLException e) {
        System.out.println("ERROR: Could not create the table");
        e.printStackTrace();
        return;
    }
}