hi everyone

I am currently practicing my java skills by doing this program called car rental management system. I am creating a login page where when the user login it should bring up a dashboard. but the problems when the user login and it say "credentials match, the dashboard doesnt come up and in the output controls I got this error msg:

Sat Jan 13 00:12:21 BOT 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertif

here is my codes

public class Login_Form extends javax.swing.JFrame {

    Connection conn;
    PreparedStatement stmt = null;
    ResultSet rs;

    public Login_Form() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLab_UserLogin = new javax.swing.JLabel();
        jLab_UserID = new javax.swing.JLabel();
        jText_UserID = new javax.swing.JTextField();
        jLab_pwd = new javax.swing.JLabel();
        jPass = new javax.swing.JPasswordField();
        jLab_display = new javax.swing.JLabel();
        jText_display = new javax.swing.JTextField();
        jLab_UserType = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox<>();
        jbtn_Exit = new javax.swing.JButton();
        jbtn_Login = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jbtn_reset = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(580, 560));
        setPreferredSize(new java.awt.Dimension(580, 560));
        getContentPane().setLayout(null);

        jPanel1.setMinimumSize(new java.awt.Dimension(580, 660));
        jPanel1.setLayout(null);

        jLab_UserLogin.setFont(new java.awt.Font("Cambria", 3, 24)); // NOI18N
        jLab_UserLogin.setForeground(new java.awt.Color(204, 0, 0));
        jLab_UserLogin.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLab_UserLogin.setText("User Login");
        jPanel1.add(jLab_UserLogin);
        jLab_UserLogin.setBounds(124, 40, 220, 30);

        jLab_UserID.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jLab_UserID.setForeground(new java.awt.Color(204, 0, 0));
        jLab_UserID.setText("User ID");
        jPanel1.add(jLab_UserID);
        jLab_UserID.setBounds(20, 110, 100, 15);

        jText_UserID.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jPanel1.add(jText_UserID);
        jText_UserID.setBounds(170, 110, 230, 21);

        jLab_pwd.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jLab_pwd.setForeground(new java.awt.Color(204, 0, 0));
        jLab_pwd.setText("Password");
        jPanel1.add(jLab_pwd);
        jLab_pwd.setBounds(20, 180, 100, 15);

        jPass.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jPanel1.add(jPass);
        jPass.setBounds(170, 180, 230, 21);

        jLab_display.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jLab_display.setForeground(new java.awt.Color(153, 0, 0));
        jLab_display.setText("Display");
        jPanel1.add(jLab_display);
        jLab_display.setBounds(20, 240, 100, 15);

        jText_display.setFont(new java.awt.Font("Cambria", 3, 11)); // NOI18N
        jText_display.setEnabled(false);
        jPanel1.add(jText_display);
        jText_display.setBounds(170, 240, 230, 20);

        jLab_UserType.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jLab_UserType.setForeground(new java.awt.Color(153, 0, 0));
        jLab_UserType.setText("UserType");
        jPanel1.add(jLab_UserType);
        jLab_UserType.setBounds(20, 310, 100, 20);

        jComboBox1.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Admin", "Receptionist 2", "Supervisor 3", "Manager 4" }));
        jPanel1.add(jComboBox1);
        jComboBox1.setBounds(170, 300, 220, 30);

        jbtn_Exit.setFont(new java.awt.Font("Cambria", 3, 14)); // NOI18N
        jbtn_Exit.setForeground(new java.awt.Color(204, 0, 51));
        jbtn_Exit.setText("Exit");
        jbtn_Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_ExitActionPerformed(evt);
            }
        });
        jPanel1.add(jbtn_Exit);
        jbtn_Exit.setBounds(173, 377, 100, 40);

        jbtn_Login.setFont(new java.awt.Font("Cambria", 3, 14)); // NOI18N
        jbtn_Login.setForeground(new java.awt.Color(204, 0, 0));
        jbtn_Login.setText("Login");
        jbtn_Login.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_LoginActionPerformed(evt);
            }
        });
        jPanel1.add(jbtn_Login);
        jbtn_Login.setBounds(310, 373, 90, 40);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Rental_Services/note.png"))); // NOI18N
        jLabel1.setText("jLabel1");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(0, 0, 510, 460);

        jbtn_reset.setFont(new java.awt.Font("Cambria", 3, 12)); // NOI18N
        jbtn_reset.setForeground(new java.awt.Color(255, 0, 0));
        jbtn_reset.setText("Reset");
        jbtn_reset.setActionCommand("");
        jbtn_reset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_resetActionPerformed(evt);
            }
        });
        jPanel1.add(jbtn_reset);
        jbtn_reset.setBounds(20, 383, 90, 40);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 510, 460);

        pack();
    }// </editor-fold>                        
 private JFrame frame;
    private void jbtn_ExitActionPerformed(java.awt.event.ActionEvent evt) {                                          
        frame = new JFrame("Exit");
        if(JOptionPane.showConfirmDialog(frame, "Confirm if you wish to exit", "Clear TextField System",
                JOptionPane.YES_NO_OPTION)==JOptionPane.YES_NO_OPTION){
                    System.exit(0);

        }

    }                                         

    private void jbtn_LoginActionPerformed(java.awt.event.ActionEvent evt) {                                           

       try{

           Class.forName("java.sql.Driver");
           Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/car_rental_management_system", "root","");
           String sql = "Select * from login where usersID = ? and password = ?";
           PreparedStatement stmt = conn.prepareStatement(sql);
           stmt.setString(1, jText_UserID.getText());
           stmt.setString(2, jPass.getText());
           ResultSet rs = stmt.executeQuery();
           if(rs.next()){
               JOptionPane.showMessageDialog(null, "login crendtials match");
               Dashboard dash = new Dashboard();
               dash.setVisible(false);

           }
           else{
               JOptionPane.showMessageDialog(null, "login credential does not match");
           }
           conn.close();

       }catch(Exception e){
           JOptionPane.showMessageDialog(null, e);
       }

hi guys

good morning to you all, i just want to say, I got it to work, i see my error, i had set the setvisible to false instead of true. but thanks anyway for the 1 view

Sometimes it takes a day. Here you posted 4AM my time and it's now 6AM and I'm just now getting a moment to look around.

However when I read any name and password routing I'm always checking to see if the code looks to be using the old way of storing the name and password. Storing the passwords is just not done anymore. Today's method? Here's a search on that:
https://www.google.com/search?q=Never+store+passwords+in+a+database

Yes, a common excuse is "I'm practicing."

May as well make it a good practice session.

I dont know what I have done wrong to offend you rproffitt but I had posted a question and all i got is 1 review and no answer but eventually I asked to same question in another forum and they pointed it out to me where my error was. so I dont see where you are coming from. but thanks anyway for the tips.

Hi divinitt02, You did not offend me at all. It seemed to me that you wanted an answer before others may wake up and check this forum. That comment about thanks for one view made me want to reply is only that answers may take a day or so as folk go about there day and pass by to see what's new here.

Do you see that now? Not offended at all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.