I get an syntax error while trying to INSERT some values to Mysql from Java.
My code looks like this:
date = new SimpleDateFormat("yyyy-MM-dd").parse(nextLine[0]);
java.sql.Timestamp sqlDate = new java.sql.Timestamp(date.getTime());
st.executeUpdate("INSERT INTO " + tick + "(day, open, high, low, close, volume) VALUES (" + sqlDate + ", " + nextLine[1] + ", " + nextLine[2] + ", " + nextLine[3] + ", " + nextLine[4] + ", " + nextLine[5] + ")");
My exception:
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 '00:00:00.0, 128.40, 128.50, 127.30, 128.20, 1415200)' at line 1
Would be glad for any help :)