Coding Fun Java Java prog#3. Login Program for java with sqlite [ Mysql ] database PART-2

Java prog#3. Login Program for java with sqlite [ Mysql ] database PART-2





The sql connect jar file can be downloaded form this link below

★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ ⚫️
Java Programming Course ➡️ ⚫️
Bash Shell Scripting Course ➡️ ⚫️
Linux Command Line…

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

35 thoughts on “Java prog#3. Login Program for java with sqlite [ Mysql ] database PART-2”

  1. Winston28 says:

    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code – Erroneous sym type: javaconnect.ConnecrDb

  2. Thanks for the video!!!
    pst.setString(2,txt_password.getText()); code gives "overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details." error .

    I solved it using replacing pst.setString(2,txt_password.getText()); line with following 2 lines

    String passText = new String(txt_password.getPassword());
    pst.setString(2,passText);

    Greetings from srilanaka !!! 🙂 love u all <3 !!!

  3. Can you please explain any specific advantage of using prepared statement instead of statement apart from the fact that we can dynamically pass the sql queries to prepared statement inside the parenthesis. I mean is there something else which Statement cannot do?

  4. i got this error .java.lang.nullpointerexception.please help me to get rid of that error.
    code goes here
    Connection con=null;
    Connectdb();
    ResultSet rs=null;
    PreparedStatement pst=null;
    String sql="SELECT * FROM users WHERE email=? and password=?";
    try
    {

    pst=con.prepareStatement(sql);
    pst.setString(1,Ljt1.getText());
    pst.setString(2,Ljt2.getText());
    rs=pst.executeQuery();
    if(rs.next())
    {
    JOptionPane.showMessageDialog(null,"email and password is correct!!");
    Lf.setVisible(false);
    homepage h=new homepage();
    }
    else
    {
    JOptionPane.showMessageDialog(null,"email and password is not correct!!");
    Ljt1.setForeground(Color.RED);
    Ljt2.setForeground(Color.RED);
    }
    }
    catch(Exception g)
    {
    JOptionPane.showMessageDialog(null, g);
    }

    method connectdb() goes here

    public Connection Connectdb(){
    try
    {
    Class.forName("org.sqlite.JDBC");
    Connection con=DriverManager.getConnection("jdbc:sqlite:C:\Users\malik muhammad usman\Docu
    JOptionPane.showMessageDialog(null,"Connection Established");
    return con;
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog(null, e);
    return null;
    }

    }

  5. I got my Audio Technica CLR100 on and the voice is coming in pretty clear
    guess I found my headphone test video

  6. thanks for this great tutorial. i need to solve this issue "java.lang.nullPointerException i need help please !

  7. Jay Jagtap says:

    where can one find those files? Which files exactly
    ?

  8. rangeela says:

    Which version of net bins are using? please tell me sir jee

  9. hi, when I click the login button, I get the error: java.lang.NullPointerException and my code is like yours. what could be the problem?

  10. ria sachdeva says:

    i am facing this error employee_table not found how to resolve this?

  11. steve tanga says:

    Great thank to you God Bless You

  12. Kazi Alamin says:

    Thank you so much…very useful

  13. java.lang.arrayindexoutofboundsexception 1 this my problem..so how can i solved it is can tell me please sir..

  14. If statement is not working. Just Else statement works for both wrong and right username and password. how can solve it?

  15. hello i have get this error message
    java.sql.SQLException : not implemented by SQLite JDBC driver

    how to solve this error

  16. I have followed the video pretty closely however when I run my project the java window pops up with no text_fields/jbuttons/jlabels/ or title. Has anyone else experienced the problem

  17. YboyAdam says:

    Please help somebody! My "Connection" , "ResultSet" and "PreparedStatement" are underlined in red (Cannot find symbol)

  18. Thanks man, i working with mysql and all go ok. For all ppl who dont need sqllite dont download the file here, dowload "mysql-connector-java-5.1.18-bin.jar".

  19. emin smd says:

    sqlitejdbc-v056 i didn't find it can u help me

  20. excuse me ProgrammingKnowledge Instructor, may I ask you something?
    How about the record logs of users? can you demonstrate that too, please?

  21. alson how says:

    Can I know what does this line means?
    pst.setString(1,txt_username.getText());
     pst.setString(2,txt_password.getText());

    what does 1 stands for? thank you.

  22. nativejosh says:

    please help me.. i have tried to insert multiple data (username and passwords) in my table and it seems to read only the last data in the table, the other data are ignored that's why when i input the data other than the last one, it displays wrong username and password.

    i believe the code should be in a loop but i have no idea what would be the condition. TIA!!

  23. Can anyone please tell me where are we linking the EmployeeInfo table with the project as I am getting the Exception that no such table exist.

  24. Paxel17 says:

    please somebody help me… 🙁 java.sql.SQLException: no suitable driver …. why ? 

  25. You Speak Some English Right ?? .. Why You Don't Speak Up .. !!

  26. Kldp Rai says:

    heheheh..its working…thnx

  27. I am getting the same error i have downloaded the jar file and opened it in the libraries but still getting lang error

  28. Silver Flame says:

    for some odd reson my one keeps telling me that my table's name does not exist??

  29. hello am a sudent in sophomore year , and the day after tomorrow I have a project supported and I need the code that you login, insertion deletion and modification and display , if you could send me would be forever indebted to him 🙂

  30. Elakid says:

    for those who get       "java.lang.NullPointerException"
    when clicking the login button
    I think you might use this code…
    just try to understand the codes.. you have to change the TABLE NAME here if you are using a different table name..
    Hope it help you guys 🙂

     try{
                String sql = "SELECT * FROM Audit WHERE Name=? and Password=?";
                PreparedStatement pst = connection.prepareStatement(sql);
                pst.setString(1, txt_username.getText());
                pst.setString(2, txt_password.getText());
                
                ResultSet rs = pst.executeQuery();
                if(rs.next()){
                    JOptionPane.showMessageDialog(null, "Username and password is correct!");
                    
                    Employee s = new Employee();
                    s.setVisible(true);
                }else{
                    JOptionPane.showMessageDialog(null, "Username and password is incorrect!");
                }
            }catch(Exception e){
                JOptionPane.showMessageDialog(null, e);
                
            }

Leave a Reply

Your email address will not be published. Required fields are marked *