Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package jendela;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.SQLException;
  11. import javax.swing.JOptionPane;
  12.  
  13. /**
  14. *
  15. * @author Tommy
  16. */
  17. class Koneksi {
  18. private static Connection conn;
  19. public static Connection bukaKoneksi( ){
  20. String host = "jdbc:mysql://localhost/kasirtes",
  21. user = "root",
  22. pass = "12345678";
  23. try{
  24. conn = (Connection) DriverManager.getConnection(host, user, pass);
  25. //JOptionPane.showMessageDialog(null,"berhasil konek");
  26. }catch (SQLException err){
  27. JOptionPane.showMessageDialog(null, err.getMessage( ) );
  28. }
  29. return conn;
  30. }
  31. public Connection panggil()
  32. {
  33. return bukaKoneksi();
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement