Java

ATM Login System using Java

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();
        }
        
    }

Paste the code inside the Login Button

    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();
        }
 
    }

I have attached the video tutorial below it will help you  to do this  step by step.

 

 

 

 

 

admin

Recent Posts

Laravel 11 CRUD Mastering RESTful API MVC with Repository Pattern

In this tutorial will teach Laravel 11 Api MVC with Repository Pattern Crud Application step…

18 mins ago

Laravel 11 CRUD Application

In this tutorial will teach Laravel 11 CRUD Application step by step. Laravel  11 CRUD…

3 weeks ago

How to make Times Table in React

in this tutorials we will be talk about how to make a times table in…

1 month ago

Laravel Tutorial: How to Add Numbers Easily Laravel 10

In this tutorials will teach How to add two numbers in Laravel 10. (more…)

1 month ago

Build Full-Stack Node.js MongoDB CRUD App with JWT Authentication

In this tutorial, we will teach the process of building a full-stack application using Node.js,…

2 months ago

Hospital Management System using OOP Java and MySQL

In this tutorial, we will explin you through the process of building a Hospital Management…

3 months ago