0

I am using the following code in selenium, but I am not able to retrieve data from database. I am getting the error "The result set has no current row"

public class Auto {

    public static void main(String[] args) throws InterruptedException, SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        System.out.println("Driver loaded");
        Connection con=DriverManager.getConnection("jdbc:sqlserver://192.168.*****\\SQLEXPRESS/*****_DW/EPS:****;user=******;password=******; ");

        System.out.println("Driver loadedd");

        java.sql.Statement stmt= con.createStatement();
        ResultSet rs=stmt.executeQuery("select * from [*****_DW].[dbo].dim_grantee ");

        System.out.println("Query executed");

        while (rs.next());
        {
            String Name=rs.getString("NAME");
            System.out.println("Name is");
        }
    }
}
  • Are you sure that the connection chain and the query are correct? – Andoxko Feb 11 '19 at 14:36
  • Yes connection string and query is correct ...but i am not able to retriev a data – Shridhar Feb 12 '19 at 5:29