Page 111 - IP
P. 111
try
{ Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/employee","root","1
234");
Statement stmt = con.createStatement();
String query= "INSERT INTO work_details
VALUES('"+leave+"','"+overtime+"','"+eno+"','"+month+"','"+year+"');";
JOptionPane.showMessageDialog(this,query);
stmt.executeUpdate(query);
}
catch(Exception e)
{ JOptionPane.showMessageDialog(this,e.getMessage());
}
2.