I am trying to make a program where I would read data from txt files and store them in tables. All .txt files would be in a specific directory. The table would have specific fields where I would create for each file in my program. I have written the code below and as you can see the user give the directory where the files are, then the data would be shown in console and then I am trying to make the table which would take as name the name of the file without the .txt
But when I am running the program I get error in lines:
stmt.executeUpdate(createtable);
and getCreateTable1(con, tablename);
.
Could anyone help me why does this happen?
What i get is this:
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)