Resultset rs=stmt.executeQuery(\"select count(*) from feedsca group by score order by score\");
Using the above java code above, am retrieving the
As far as my knowledge, your query will only get one row and column i.e., the total number of rows that your query returns.
Say for example :
Select count(*) from emp; Generally this query will return a value 14.
so your java code
if(rs.next())
rs.getInt(1);
will return only one value i.e., 14
So, How can you access rs.getString(2). This will automatically throws an exception which you got in the second case.