Advertisement
rasyid03

java

May 15th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package javaapplication1;
  6. import java.sql.Connection;
  7. import java.sql.DriverManager;
  8. import java.sql.SQLException;
  9. /**
  10. *
  11. * @author faris
  12. */
  13. public class JavaApplication1 {
  14.  
  15. /**
  16. * @param args the command line arguments
  17. */
  18. public static void main(String args[]) {
  19. Connection conn = null;
  20. try {
  21. System.out.println("Koneksi sedang berjalan...");
  22.  
  23. String url = "jdbc:mysql://localhost/SEWA_RUANG";
  24. String user = "root";
  25. String password = "";
  26.  
  27. conn = DriverManager.getConnection(url, user, password);
  28. System.out.println("Koneksi Berhasil");
  29. } catch (SQLException e) {
  30. System.out.println(e.getMessage());
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement