there mysql table primary key id int auto_increment , need insert multiple rows in batch multiple insert statement, autocommit disabled, following: set autocommit=0; insert dummy(name, `size`, create_date) values('test', 1, now()); insert dummy(name, `size`, create_date) values('test', 2, now()); commit; is possible each generated id, instead of last id. if yes, when each id generated, , how ids via jdbc ? thx. if want retrieve auto_increment keys via jdbc need use jdbc features doing ( return_generated_keys , .getgeneratedkeys() ), this: try (connection conn = drivermanager.getconnection(myconnectionstring, "root", "beer")) { try (statement st = conn.createstatement()) { st.execute( "create temporary table dummy (" + "`id` int auto_increment primary key, " + "`name` varchar(50), " + "`size` int, " ...