I have written a query which retrieves data from a table and then I am checking the number of rows in the resultset using getRow()
method. This is printing 0
,however my table contains multiple row column data in it.
I checked previous questions here and found one much similar here. But unlike what is mentioned in that I do not have any permissions defined and connection to the database is well established. It is a very simple query returning updatable resultset as following:
if(temp == null) {
query = "SELECT * FROM altemp1";
pstmt = cn.prepareStatement(query, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
temp = pstmt.executeQuery();
System.out.println("TEMP LENGTH : "+temp.getRow());
}
temp is the ResultSet and altemp1 is the table in DB.
The check above if temp
is null? is for some logical purpose.