daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Sep 25th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2.             Class.forName("com.mysql.jdbc.Driver");
  3.         } catch (ClassNotFoundException ex) {
  4.             System.out.println(ex);
  5.         }
  6.         try {
  7.             Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3311/Books","root","root");
  8.             Statement statement = con.createStatement();
  9.             String sql = "insert into student(studid,fname,lname,course,yr) value ('"+txtID.getText()+"', '"+txtFName.getText()+"', '"+txtLName.getText()+"', '"+txtCourse.getText()+"', "+txtYear.getText()+")";
  10.             statement.execute(sql);
  11.         } catch (SQLException ex) {
  12.             System.out.println(ex);
  13.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top