The ATM Login System is developed using Java and mysql.In this tutorial we explain how to set security password. We have created two fields Account No,Pinno. : Enter the Account No and Pinno in the database matches.if the Account matched with Pinno Display the Message as “Welcome” otherwise “Check the Accno and Pinno”.
First Step we created database which name is “lmc” inside the database created the table users .user table consist of following coloums id,accno,pinno.
Second Step after design the form we have established the database connection inorder to connect java and mysql databse. I wrote the code below.
import java.sql.*; // Connection con; PreparedStatement pst; ResultSet rs; public void Connect() { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/lmc", "root", ""); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); } }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { String accno = txtaccno.getText(); char pwd[] = txtpinno.getPassword(); // use the getPassword method for set security password String vpwd = new String(pwd); pst = con.prepareStatement("select pinno from users where accno = ?"); pst.setString(1, accno); rs = pst.executeQuery(); if(rs.next()) { String dbpwd = rs.getString(1).trim(); if(vpwd.equals(dbpwd)) { JOptionPane.showMessageDialog(this, "Welcom LMC Bank"); } } else { JOptionPane.showMessageDialog(this, "Check Accno and Pinno"); txtaccno.setText(""); txtpinno.setText(""); txtaccno.requestFocus(); } } catch (SQLException ex) { ex.printStackTrace(); } }
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
Act as a Java developer to create a program that calculates the gross wage for…
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
In this tutorial, we will teach you how to create a simple school management system…
I have design the Admin Basic templete using React MUI Design Admin Dashboard and Login.Here…
In this tutorial ,i am to going teach the Laravel Breeze.Laravel Breeze provides a simple…