I\'m trying to do a simple insert into a database with java and its telling me my sql syntax is off. But when I copyed the string I printed out and put it into the sql command i
Don't you need a terminating ; on your sql statement. Also you should look into JPA, which will do all this database querying itself
You're calling the base Statement.executeUpdate(String)
method, which has nothing to do with PreparedStatement
and simply executes a string of raw SQL.
You need to call statement.executeUpdate()
without parameters to use the derived method n PreparedStatement
.