Am new to JDBC and am having some problems inserting into a table using variables. I am inserting into a table Players(PlayerID, firstname, surname, attempts). Player ID is autoincrement.
Here is the code:
Can anyone see where i am going wrong? Apparently i have an error in my sql syntax.
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
String insertPlayer = ("INSERT INTO Player" + "VALUES" + "(?, ?, ?)");
insertplayer = conn.prepareStatement(insertPlayer);
int rowCount = insertplayer.executeUpdate();
System.out.println("rowCount=" + rowCount);
System.out.println("Inserted record into the table...");