Here is my code...
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class example1{
public static void main(String[] args)
{
try
{
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","user","password");
Statement state = (Statement) con.createStatement();
String username = "John";
String password = "John1";
int experience = 0;
int level = 1;
String insert = "INSERT INTO userInfo VALUES("+ username +","+ password +","+ experience +","+ level +").";
state.executeUpdate(insert);
}
catch( Exception E )
{
System.out.println( E.getMessage() );
}
}
}
I'm getting this error
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 '.' at line 1.
How do I fix this?
Thanks tons
Peace and love,
oldezwe