Hey guys I have scoured the many other answers and am still unable to figure out this problem.
statement.executeUpdate("CREATE TABLE IF NOT EXISTS recentlyWatched (fileName STRING NOT NULL, fileLocation STRING, viewCount INTEGER, PRIMARY KEY (fileName))");
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:media.db");
statement = connection.createStatement();
statement.executeUpdate("INSERT INTO recentlyWatched (fileName, fileLocation, viewCount) VALUES ('"
+ fileName + "', '"
+ fileLocation + "', 0) ON DUPLICATE KEY UPDATE viewCount = '1'");
I have tried numerous ways to resolve this issue and am at a loss whenever i try to insert a record i get "java.sql.SQLException: near "ON": syntax error".
Update
Final code looked like this
statement.executeUpdate("INSERT OR IGNORE INTO recentlyWatched (fileName, fileLocation, viewCount) VALUES ('"
+ fileName + "', '"
+ fileLocation + "', 0)");
statement.executeUpdate("UPDATE recentlyWatched SET viewCount = viewCount + 1 WHERE '" + fileName + "' LIKE fileName;");