Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 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 koneksi;
  7. import com.mysql.jdbc.Driver;
  8. import java.sql.DriverManager;
  9. import java.sql.Connection;
  10. import java.sql.SQLException;
  11.  
  12. /**
  13.  *
  14.  * @author RIDHWAN
  15.  */
  16. public class Koneksi {
  17.     private static Connection cons;
  18.    
  19.     public static Connection GetConnection()throws SQLException {
  20.         if (cons == null) {
  21.             new Driver();
  22.            
  23.             cons = DriverManager.getConnection("jdbc:mysql://localhost/db_kampus", "root", "");    
  24.         }
  25.         return cons;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement