Advertisement
Guest User

Untitled

a guest
Jan 9th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
  2.  
  3. try{
  4. String URL = "jdbc:derby://localhost:1527/security-access"; String
  5. username="sam";
  6. String password="asdasd";
  7. Connection con=DriverManager.getConnection(URL,username,password);
  8. Statement stat=(Statement) con.createStatement(); String Query="INSERT INTO security (user_key) " + "VALUES ('" + jTextField1.getText() + "')"; JOptionPane.showMessageDialog(null, "Key added"); jTextField1.setText(null); stat.execute(Query);
  9. }catch (SQLException ex){
  10. JOptionPane.showMessageDialog(null, ex.toString());
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement