This sounds like the issue where Access fails to properly update the row count in the table metadata when performing certain operations (e.g., manually inserting or deleting rows in Access datasheet view). If Jackcess reads that metadata value for operations like Table#getRowCount() then it can report an incorrect number of rows.
The counts can be fixed in the table metadata by doing a Compact and Repair Database operation in Access. The actual number of rows could also be determined by doing a table scan, but that could obviously be slower than just reading a single metadata value. Doing a scan of an IndexCursor based on the primary key of the table might be a somewhat faster alternative to a full table scan.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get a non-zero value from table.getRowCount() eventhough it has no data and at times zero for a table with data. What could be the reason?
This sounds like the issue where Access fails to properly update the row count in the table metadata when performing certain operations (e.g., manually inserting or deleting rows in Access datasheet view). If Jackcess reads that metadata value for operations like
Table#getRowCount()
then it can report an incorrect number of rows.The counts can be fixed in the table metadata by doing a Compact and Repair Database operation in Access. The actual number of rows could also be determined by doing a table scan, but that could obviously be slower than just reading a single metadata value. Doing a scan of an IndexCursor based on the primary key of the table might be a somewhat faster alternative to a full table scan.