Guest User

Untitled

a guest
Dec 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. String Username = jTextFieldUsername.getText();
  2. String Password = jTextFieldPassword.getText();
  3. try { Class.forName("com.mysql.jdbc.Driver"); }
  4. catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException: " + e.getMessage()); }
  5. String passwordDB = "";
  6. try {
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ipig", "root", "root");
  8. Statement stmt;
  9. stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
  10. stmt.executeUpdate("Insert into login(username,password)values('"+Username+"','"+Password+"')" );
  11.  
  12. stmt.close();
  13. con.close();
  14. new register().setVisible(false);
  15. new iPig2().setVisible(true);
  16.  
  17. }
  18. catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); }
Add Comment
Please, Sign In to add comment