Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public void getConnection() {
  2. try {
  3.  
  4. loadDriver();
  5.  
  6. String urlDatabase = "jdbc:mysql://localhost/student"; //alamat database
  7. String user = "root"; //user yang dipakai utk akses database
  8. String password = ""; //password yang digunakan utk akses database
  9. connection = DriverManager.getConnection(urlDatabase, user, password);
  10. } catch (SQLException ex) {
  11. JOptionPane.showMessageDialog(null, "Connection Failed! " + ex.getMessage());
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement