Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- /**
- * Ini adalah class koneksinya
- * @author Resa C.R
- */
- public class Koneksi
- {
- private static Connection koneksi;
- public static Connection getKoneksi()
- {
- if(koneksi == null)
- {
- try
- {
- DriverManager.registerDriver( new org.apache.derby.jdbc.ClientDriver());
- koneksi = DriverManager.getConnection("jdbc:derby://localhost:1527/Penjualan;user=root;password=root");
- }
- catch(Exception ex)
- {
- System.out.println("Gagal Koneksi ke Database");
- System.out.println(ex);
- }
- }
- return koneksi;
- }
- }
Add Comment
Please, Sign In to add comment