Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.qbiel.koneksi;
- import com.mysql.jdbc.Connection;
- import com.mysql.jdbc.Driver;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- /**
- *
- * @author qbiel
- */
- public class Koneksi {
- private static Connection konek;
- public static Connection getConnection() throws SQLException{
- String url = "jdbc:mysql://localhost/Jurusan";
- String user = "root";
- String pass = "root";
- if (konek == null){
- try{
- Driver driver = new Driver();
- konek = (Connection) DriverManager.getConnection(url,user,pass);
- }catch(Exception e){
- System.err.println("Error "+e);
- }
- }
- return konek;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement