import java.sql.*;
import javax.swing.JOptionPane;
public class koneksi {
Connection conn;
Statement st;
ResultSet rs;
public Connection setKoneksi(){
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost/penjualan","root","");
st=conn.createStatement();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Koneksi Gagal : " +e);
}
return conn;
}
}
------------------------------------------------------------------------------
Database: penjualan
a. Tabel : produk
( Id_produk Char 10) Primary Key )
( Id_kategori Int )
( Nama_produk Varchar 30 )
( Unitcost Double
)
( Id_supplier Char 10
)
b. Tabel : Kategori
( Id_kategori Int 3 Primary Key )
( Nama_kategori Varchar 30 )
c. Tabel : pegawai
( Id_pegawai Char 8 Primary Key
)
( Username Varchar 15
)
( Password Varchar 15
)
( Departemen Varchar 20
)
( Manajer Varchar 30
)
Isikan data melalui menu Insert:
P001, Yudhistira, 123, Technical, Support Andi
P002, Riyadi, Riyadi, Accounting, Budi
d. Tabel : Supplier
( Id_supplier Char 10 Primary Key
)
( Nama_supplier Varchar 30
)
e. Tabel : Pesanan
( Id_pesanan Char 8 Primary Key
)
( Id_pegawai Char 8
)
( Tgl_pesanan Date
)
( Status Varchar 15
)
f. Tabel : item_pesanan
( Id_pesanan Char 10 Foreign Key
)
( Id_produk Char 10
)
( Qty Int
)
g. Tabel : sementara
( Id_produk Char 10
)
( Qty Int )
Ещё видео!