Problem inserting into database
Good day,
I've developed an application that is reading data from a file and saving it into a database (I'm using MySql). Unfortunately I'm having problems inserting the data. Below is the relevant piece of code (I'm trying to create a table using the name of the file that my application is reading) and the SQL error I get:
Class.forName("com.mysql.jdbc.Driver").newInstance ();
con = DriverManager.getConnection("jdbc:mysql:///mastersdata", "root", "");
if(!con.isClosed())
stat = con.createStatement();
stat.execute("CREATE TABLE " + selectedFile.getName());
Message: 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 '300160' at line 1
Please note that 300160 is the name of the file my application is reading and which I want to use to name the table I'm trying to create.
Many thanks