47 thoughts on “Login Form in java using Netbeans and Sql Server

  1. try{
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    String url = "jdbc:sqlserver://localhost:1433;databaseName=dbTest;user=sa;password=1234";

    Connection con = DriverManager.getConnection(url);
    System.out.println("connection created");

    String sql="select * from loginTable where Username=? and Passeword=?";
    PreparedStatement pst = con.prepareStatement(sql);
    pst.setString(1, username.getText());
    pst.setString(2, password.getText());
    ResultSet rs=pst.executeQuery(sql);
    if(rs.next())
    {
    JOptionPane.showMessageDialog(null, "password and username matched");
    //System.out.println("Address : "+rs.getString(2));
    }
    else {
    JOptionPane.showMessageDialog(null,"password or username not corrected");
    username.setText("");
    password.setText("");
    }
    con.close();
    }
    catch(SQLException e)
    {
    JOptionPane.showMessageDialog(null, e);
    }

  2. Hi, I have a problem when running my project in NetBeans 8.2 and SQL server express 2014.
    After doing the programming it shows the result as below

    " com.microsoft.sqlserver.jdbc.sqlservExeption Login failed for user ''. ClientConnectionid: d963d05c-a68b-49c0-a7e9-88b829c96174 "

    Can anybody help me with this issue, please?

  3. Hello My Brothers and Sisters. My humble request to you, Please Don't Forget To Subscribe
    If you have any problem, Comment down. I will provide you solution as soon as possible.

  4. Hi Indra. I am using Windows Authentication and put the JAR files into the libraries already, also putting the sqljdbc_auth.dll file into my System32 as i read the comments. But i still couldn't execute my program, with the error shown below.

    Error Pop-up Message: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionID:……….
    Error shown in netbeans:
    Mar 25, 2018 11:12:48 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
    WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path

    May i know how can i solve this?

  5. hi bro, i have a problem at :com.microsoft.sqlserver.jdbc.SQLServerExeception: The method executeQuery() cannpt take arguments on a PreparedStatement or CallableStatement

  6. I wanna Link To Make Form Insert Update delate System to Java and SQL server Plz Tel me if you Can Bro Thnx

  7. hello Sir
    i saw your tuto and it is very well made
    but i'm one thin that i don't get
    i'm working with NetBeans Build-in DataBase so how can i get the Class.ForName(" ") ? help me please

  8. how do i solve the problem "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionID:21e0f682-39b9-4bab-9f78-b5483df3fae6"

    my authentication is windows authentication only, do I need to change it to SQL authentication?

  9. I'm not using an IDE. I use notepad so, how do you think I can connect a database and insert data into it through notepad? (Please, tell me how can I install and use the drivers with notepad, too. Please)

  10. bro..i have a question here…where did you used the password orchid in sql ???
    if you could tell me then it will be very helpful 🙂

Leave a Reply

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