java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). String DRIVER = "com.mysql.jdbc.Driver"; Class.forName(DRIVER).newInstance(); String url="jdbc:mysql://localhost:3306/regis?user=root&password=fraze"; Connection Conn = DriverManager.getConnection(url); String strSQL = "select username,password from users where username like '%s'; PreparedStatement statement = Conn.prepareStatement(strSQL); statement.setString(1, user); statement.setString(2, pass); ResultSet Rs= statement.executeQuery(strSQL); if(myRs.next()){ out.println("Login Succesful! A record with the given user name and password exists"); } else { out.println("Login Failed. No records exists with the given user name and password"); } statement.close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)