Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.net.ServerSocket;
- import java.net.Socket;
- import java.sql.*;
- public class Server {
- public Connection koneksi;
- public Server() throws ClassNotFoundException, SQLException {
- Class.forName("com.mysql.jdbc.Driver");
- koneksi = DriverManager.getConnection("jdbc:mysql://localhost:3306/pulsaapp","root","");
- }
- public void Login(Integer id, String password) throws SQLException, ClassNotFoundException {
- String sql = "SELECT id,password FROM karyawan WHERE id = ? AND password = ?";
- PreparedStatement statement = koneksi.prepareStatement(sql);
- statement.setInt(1,id);
- statement.setString(2,password);
- ResultSet rs = statement.executeQuery();
- if(rs.next()) {
- new Dashboard();
- } else {
- JOptionPane.showMessageDialog(null,"Id Atau Password Salah");
- }
- }
- public static void main(String[] args) throws IOException {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement