Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package config;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.sql.Statement;
- import javax.swing.JOptionPane;
- /**
- *
- * @author nasution
- */
- public class Koneksi {
- private static Connection koneksi;
- public static Statement stm;
- public static Connection getKoneksi() throws ClassNotFoundException{
- try{
- Class.forName("com.mysql.jdbc.Driver");
- koneksi = DriverManager.getConnection("jdbc:mysql://localhost/db_surat","root","");
- }catch(SQLException e){
- JOptionPane.showMessageDialog(null, "koneksi gagal"+ e.getMessage());
- }
- return koneksi;
- }
- }
Add Comment
Please, Sign In to add comment