Hi all,
I have an application using an MS Access 2000-2003 database (.mdb file) via the ODBC Jet engine driver version 4. I have a prepared SQL statement which issues a simple SELECT query with 2 parameters. The database file itself is only ~2Mb.
I bind the 2 parameters (SQLBindParameter), bind 2 columns (SQLBindCol) in which to hold results (row size = 1) and finally execute the query. I fetch the results which are as expected. I then call SQLCloseCursor(stmt), SQLFreeStmt(stmt, SQL_RESET_PARAMS) and SQLFreeStmt(stmt, SQL_UNBIND) because I want to reuse the statement handle as the MSDN docs advise. However, if I run this simple bit of code repeatedly over a significant period of time (6-7 days) I notice a steadily growing temporary file typically called JETxxxx.tmp in the temp files folder. Once this file reaches 2GB the ODBC calls on the above statement handle fail with some sort of resource exceeded error.
If I repeat the above but reallocate the statement handle on each iteration the problem disappears. However, the MSDN docs imply that you suffer a performance hit as the driver is freeing and reallocing resources for the statement.
No changes are being made to the Access database, this is the only application accessing it to perform a SELECT. I didn't want to use SQL server to minimise installation dependencies at this time. Has anyone else noticed this problem? Is there a solution? There are workarounds, as mentioned above, but potentially I will be executing a large number of queries very frequently so want to minimise the penalties incurred. So unless I'm mistaken, the Jet engine is leaking space in this temporary file eventually reaching its self imposed limit.
Thanks in advance,
Rob.