I'm pretty new to this so maybe be stupid question but here goes:
I have created a servlet that via an sql statement get login and password value from mysql database. I then compare this to user and param parameters entered in html login page.
I then compare the userparam and userpassord against the database information and I get the following error: Error! Opening connection has failed: java.sql.SQLException: Before start of result set java.sql.SQLException: Before start of result set
I cannot see what is causing this error. I'm really struggling here, here the code causing error: String queryEmpUser = "SELECT * FROM employees WHERE ((login = '" + userParam +"')" +" AND (password = '"+ passwordParam +"'))"; String queryClients = "SELECT * FROM clients";
ResultSets start in a 'before first' position, you always have to call rs.next() before trying to access the data in the ResultSet. You should always check the result of rs.next() to make sure there is actually some thing to read.