Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

accessing 'locked' tables

hantunca
2005-05-05
2013-05-01
  • hantunca
    hantunca
    2005-05-05

    I've been using the Java version of mdbtools to access a Microsoft Access database.  The database has multiple tables in it.  One of the tables is kept open and  is being written to by an application throughout the day.  When I tried to access the table (i.e. run the query select * from table) I got no results even though I could open up the table in Access and see rows.  I started poking around in the mdbtools code, and found the problem in mdbtools.libmdb.table - in there is a line of code that sets the num rows for the table:   table.num_rows = file.mdb_get_int32(mdb, fmt.tab_num_rows_offset);  For the table in question, the num rows was always being set to 0.  Looking at the data read from the table, it does seem to be set to 0.  On a hunch, I modified the code to set table.num_rows = 1 if it found num_rows = 0.  When I did this, I was then able to read all of the rows from the table.

    I saw a question in the archived mailing lists about accessing locked tables, so I thought I'd post this for others.