Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package src.id.lib;
- import com.mysql.jdbc.Driver;
- import java.sql.*;
- public class koneksi {
- private static Connection koneksi;
- public static Connection GetConnection() throws SQLException {
- if (koneksi == null) {
- new Driver();
- koneksi = DriverManager.getConnection("jdbc:mysql://localhost:3306/workshop_ti_mhsbaru", "root", "");
- }
- return koneksi;
- }
- public static void main(String args[]) {
- try {
- GetConnection();
- System.out.println("Koneksi Berhasil");
- } catch (SQLException ex) {
- System.err.println("Koneksi Gagal");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement