Question: ```
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.

Answer: 
This is what the MySQL manual says about using an [insert](http://dev.mysql.com/doc/refman/5.6/en/insert.html) without column list:

> 
> If you do not specify a list of column names for INSERT ... VALUES or
>  INSERT ... SELECT, values for every column in the table must be
>  provided by the VALUES list or the SELECT statement.
> 
> 
> 

So, even if `uid` has the `autoincrement` flag, you still need to specify in the insert statement for which columns you present values. As a solution, you can simply modify your insert statement:

```
insert into user (username, password) values (?, ?)

```

(I supposed that `username` and `password` are the names of the columns.)

You can read more about using autoincrement [here](http://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html)
netbeans evaluates the field in different way in mysql cmd if you would type this syntax say
insert into user ('username', 'password') values ('xyz', 'abc');
it would work perfectly fine but in netbeans the tables and field names are indicated not in single quotes but in `` this type of quotes so this would perfectly fine in netbeans
insert into `user` (`username`, `password`) values ('xyz', 'abc');
where string like xyz and abc are expressed in single quotes...