Guest User

Untitled

a guest
Oct 7th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import java.sql.*;
  2. /**
  3. * Ini adalah class koneksinya
  4. * @author Resa C.R
  5. */
  6. public class Koneksi
  7. {
  8. private static Connection koneksi;
  9.  
  10. public static Connection getKoneksi()
  11. {
  12. if(koneksi == null)
  13. {
  14. try
  15. {
  16. DriverManager.registerDriver( new org.apache.derby.jdbc.ClientDriver());
  17. koneksi = DriverManager.getConnection("jdbc:derby://localhost:1527/Penjualan;user=root;password=root");
  18. }
  19. catch(Exception ex)
  20. {
  21. System.out.println("Gagal Koneksi ke Database");
  22. System.out.println(ex);
  23. }
  24. }
  25. return koneksi;
  26. }
  27. }
Add Comment
Please, Sign In to add comment