I have a component that loops through a list of MS Access files, reads and merges the data and returns the combined results. So far so good.
I then want to then run an external process (7zip) which will archive these files after I have processed them.
The issue I have is that Knime is not closing the mdb file after reading the table data and 7zip fails since the file is locked by another process (knime). I have tried using the below attempt to close the connection, but it does not work. The only way I can get Knime to release the file is to close Knime, which is not a solution
I appreciate any help you can provide!
Hi @grathmell and welcome to the Knime Community.
Indeed, if you don’t close the connection, you can’t zip the file.
The DB Connection Closer should help. We can’t see what’s on the right of your workflow there, but if you 're zipping after the DB Reader, it will fail, because you are running that node in parallel with the DB Connection Closer. You need to run the zip only after the Connection Closer has been executed.
To do this, you need to connect the DB Connection Closer node to whatever is happening after the DB Reader node. That way, the DB Connection Closer will execute before anything that runs after the DB Reader node.
EDIT: Here’s to illustrate what I mean:
That Node 7 will only execute after Node 6 has executed, so this forces the Zip Files node to run only after the DB Connection has been closed.
Thanks for the quick response, I made the extra connection to a downstream node as suggested (via the variable in/out) but Knime is still not releasing the file.
Update I discovered the built in “compress files/folders” node and was able to use that instead of the external application, even though the file appears to remain locked by Knime.
Here is the entire component I built to read a list of mdb files. I’m still learning but this works great otherwise. The Extract Dimensions node is only there as a dummy node prior to the close connection attempt.
@grathmell there also is a wait node so you can give the closing process a few seconds to complete
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.