This tutorial will teach you Simple Sales Inventory System in Java and mysql.this example which will help you to learn the auto no generating using by the code. FirstStep : we have to establish the database connection Connection con; PreparedStatement pst; public void Connect() { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/vmproducts","root",""); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (SQLException …