I am connecting to a Microsoft Database using the JDBC-ODBC Driver. I would like to get the record count using the following SQL command:
'SELECT COUNT (*) from Table'
How can I set the return value to a variable. Please be explicit. The better the answer and I will give more points.
The only other way that I can get the record count is by getting the resultSet and using next() in a while loop to scroll through the resultset and using a counter to count the numbers of loops. This seems like a very inefficient method, because then I also need to keep track of the record before I got the record count and then I have to re-sql the table to scroll forward to the record where I was before I got the recordcount.
If there is a better way, that works, then what I am asking for please also tell me.
Using last() returns an error telling me that the record is FORWARD_ONLY. Using next() by itself and then trying to use getRow() will return 0 because next() always scrolls past the end of the resultset. Using isLast() returns the same error as last().