I'm trying to build a login UI with Java. But there is a problem with my SQL authentication
Here's the code:
public void actionPerformed(ActionEvent e){
if (e.getSource() == Login)
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:MessageStore","sa","12345");
Statement cmd=con.createStatement();
ResultSet rs=cmd.executeQuery("select * from UserList where UserName='"+nameText.getText());
}
But there is a warning with "rs": The value of the local variable rs is not used
How to solve this problem?
Or is there more straightforward code to implement SQL authentication?
Thank you