document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  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 database;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.SQLException;
  11.  
  12. /**
  13.  *
  14.  * @author Koesumah
  15.  */
  16. public class koneksi {
  17.     private static Connection koneksi;
  18.     public static Connection getkoneksi(){
  19.         if (koneksi==null){
  20.             try{
  21.               String url = new String();
  22.               String user = new String();
  23.               String password = new String();
  24.               url ="jdbc:mysql://localhost:3306/db_covid19";
  25.               user="root";
  26.               password="koesumah29";
  27.               DriverManager.registerDriver(new com.mysql.jdbc.Driver());
  28.               koneksi =(Connection)DriverManager.getConnection(url,user,password);
  29.         }catch(SQLException t){
  30.             System.out.println("Koneksi error");
  31.         }
  32.     }
  33.     return koneksi;
  34. }
  35. }
');