我想制作一个程序,我将从txt文件中读取数据并将它们存储在表中。所有.txt文件都将位于特定的目录中。该表格将具有我要为我的程序中的每个文件创建的特定字段。 我已经写下了下面的代码,正如你可以看到用户给出的文件所在的目录,然后数据将显示在控制台中,然后我试图制作表,这将作为名称的文件的名称没有中的.txt创建表时出错
但是,当我运行程序我得到了行错误:
stmt.executeUpdate(createtable);
和getCreateTable1(con, tablename);
。
任何人都可以帮助我为什么会发生这种情况?
什么,我得到的是这样的:
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 'DATE VARCHAR(255), HOUR VARCHAR(255), LITRES VARCHAR(255)' at line 1
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 'DATE VARCHAR(255), HOUR VARCHAR(255), LITRES VARCHAR(255)' at line 1
at notepad.getCreateTable1(notepad.java:97)
at notepad.main(notepad.java:76)
你得到的错误是什么? –
我们可以进行堆栈跟踪吗? –
发布错误日志.. – MaheshVarma