Advertisement
Guest User

koneksi

a guest
Apr 7th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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.  
  7. package rental;
  8. import java.sql.*;
  9. import javax.swing.JOptionPane;
  10. /**
  11. *
  12. * @author ECS
  13. */
  14. public class koneksi {
  15. Connection conn;
  16. public koneksi(){
  17. try{
  18. Class.forName("com.mysql.jdbc.Driver");
  19. conn =DriverManager.getConnection("jdbc:mysql://localhost/sewa","root","");
  20. } catch (Exception e){
  21. JOptionPane.showMessageDialog(null,"Koneksi Database Gagal !");
  22. }
  23. }
  24. Connection logon(){
  25. try{
  26. Class.forName("com.mysql.jdbc.Driver");
  27. conn =DriverManager.getConnection("jdbc:mysql://localhost/sewa","root","");
  28.  
  29. } catch (Exception e){
  30. }
  31. return conn;
  32. }
  33. public static void main(String args[]){
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement