Guest User

Untitled

a guest
Nov 5th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package config;
  2. import java.sql.Connection;
  3. import java.sql.DriverManager;
  4. import java.sql.SQLException;
  5. import java.sql.Statement;
  6. import javax.swing.JOptionPane;
  7. /**
  8. *
  9. * @author nasution
  10. */
  11. public class Koneksi {
  12. private static Connection koneksi;
  13. public static Statement stm;
  14.  
  15. public static Connection getKoneksi() throws ClassNotFoundException{
  16. try{
  17. Class.forName("com.mysql.jdbc.Driver");
  18. koneksi = DriverManager.getConnection("jdbc:mysql://localhost/db_surat","root","");
  19. }catch(SQLException e){
  20. JOptionPane.showMessageDialog(null, "koneksi gagal"+ e.getMessage());
  21. }
  22. return koneksi;
  23. }
  24.  
  25. }
  26.  
  27. Class-Path: lib/mysql-connector-java-5.1.23-bin.jar
Add Comment
Please, Sign In to add comment