Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package jendela;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import javax.swing.JOptionPane;
- /**
- *
- * @author Tommy
- */
- class Koneksi {
- private static Connection conn;
- public static Connection bukaKoneksi( ){
- String host = "jdbc:mysql://localhost/kasirtes",
- user = "root",
- pass = "12345678";
- try{
- conn = (Connection) DriverManager.getConnection(host, user, pass);
- //JOptionPane.showMessageDialog(null,"berhasil konek");
- }catch (SQLException err){
- JOptionPane.showMessageDialog(null, err.getMessage( ) );
- }
- return conn;
- }
- public Connection panggil()
- {
- return bukaKoneksi();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement