import java.sql.*; public class sqlbatch { public static void main(String args[]) { Connection con = null; Statement st = null; ResultSet rs = null; String url = "jdbc:mysql://192.168.10.13:3306/"; String db = "ankdb"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = "root"; try { Class.forName(driver); con = DriverManager.getConnection(url + db, user, pass); st = con.createStatement(); st.addBatch("INSERT INTO cellular " + "VALUES('3036','9560534071')"); st.addBatch("INSERT INTO cellular " + "VALUES('3037','9560534072')"); st.addBatch("INSERT INTO cellular " + "VALUES('3038','9560534073')"); st.executeBatch(); String sql = "select * from cellular "; rs = st.executeQuery(sql); System.out.println("ID \tMOBILE"); while (rs.next()) { System.out.print(rs.getInt(1) + " \t"); System.out.println(rs.getString(2)); } rs.close(); st.close(); con.close(); } catch (Exception e) { e.printStackTrace(); } } }