flushing database cache in SWI-Prolog
We are using swi-prolog
to run our testcases. Whenever the test starts, I am opening the connection to MYSQL database
and storing the Name of the Test hat is being done and then closing the DB. These tests run for about 2 days continuously. After the tests are done, the results basically gets stored in folder in the server. There is a predicate in another prolog file that is called to update the results to the MYSQL database. The code is simple, I use odbc
library and just call odbc_*
predicates to connect and update the mysql by issuing direct queries.
The actual problem is :
- If I try to call the Predicate from the same Prolog window, where the开发者_Go百科 test just got completed, I get an error as updating to the DB server. Although I do not get any error in the connection. If I close the session of that prolog with
halt
and closing all the open prolog windows , then open an other complete new instance of Prolog and run the predicate the update goes well.
I have a feeling that there is some connection reference to the MySQL DB in Prolog database. Is there any way to clear the database in prolog so that I can run the same predicate without closing any existing prolog windows?
Any ideas appreciated.
Thanks.
If you open the connection, than do a long processing, MySQL can drop the connection in between after a certain timeout (that I believe can do configured in my.cnf
).
EDIT: swi-prolog has an odbc_disconnect
that can be used to explicitly close the connection after using it and an "aliasing" mode that can be used to obtain a previously opened connection when using odbc_open
. In you case you can try either closing the connection after using it. You should also avoid using an alias when opening.
精彩评论