Created
May 6, 2012 06:19
-
-
Save resarahadian/2620437 to your computer and use it in GitHub Desktop.
Program Menu Login dengan Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment