Connection conn = null;
PreparedStatement pst = null;
try {
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/chatdata", "admin", "int*M=9167757203");
pst = conn.prepareStatement("insert into user values (?, ?)");
} catch (Exception e) {
}
String password;
String userName;
try {
BufferedReader kin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Username :: ");
userName = kin.readLine();
System.out.println("Enter Password :: ");
password = kin.readLine();
pst.setString(1, userName);
pst.setString(2, password);
pst.execute();
} catch (Exception e) {
System.out.println(e);
}
This code is showing me the error:
"java.sql.SQLException: Column count doesn't match value count at row 1"
While my table has three column entries uid which is AUTO_INCREMENT and username and password the two strings that I have to pass so please if anybody can find the answer please help.