/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Koesumah
*/
public class koneksi {
private static Connection koneksi;
public static Connection getkoneksi(){
if (koneksi==null){
try{
String url = new String();
String user = new String();
String password = new String();
url ="jdbc:mysql://localhost:3306/db_covid19";
user="root";
password="koesumah29";
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
koneksi =(Connection)DriverManager.getConnection(url,user,password);
}catch(SQLException t){
System.out.println("Koneksi error");
}
}
return koneksi;
}
}