id parameter setting when JDBC inserts records

When we set the id in the data table as the primary key, and the id of the inserted data increases automatically, then we have to set the id field in the data table to auto-increment, and then do not need to fill in the id value when inserting, taking the MySQL database user table as an example:

insert into user(username,password) value('admin',MD5('admin'));

When inserting data in this way, the id will automatically generate a number.

Note: When setting automatic growth, the id cannot be 0, because the database id starts from 1, otherwise an error will be reported.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325015434&siteId=291194637