Hello,
I have an application which should run on an USB stick.
So FM-Win-Application and SQliste DB.
On Application start I connect to the DB and keep it open.
Open tables which I need and keep it open
Now the problem:
When I remove the USB stick (for which reason ever) and connect again and try to access the DB I always get an file io error (On Error).
What can I do to prevent this? Always close the DB/tables after each request/insert??
Or can I "quietly" reconnect to DB after "On Error"??
File I/O Error - SQlite
Re: File I/O Error - SQlite
SQLite is a file-oriented database. Commonly, it uses a single database file, but in addition there is a couple of temporary files which are implicitly created and used by SQLite during processing a database ( http://www.sqlite.org/tempfiles.html ).
Therefore, the situation where an I/O error arises is quite expected when removing/inserting a USB drive.
To avoid this, please try to perform the following steps:
- in the UniConnection.OnError event handler set the Fail variable to False in order to avoid the error message;
- set the UniConnection.Options.DisconnectedMode property to True. When setting the property to True, a connection is opened only when it is required and datasets remain open when the connection is closed. Note, that in this case you should not re-open the connection explicitly in the OnError event handler.
You can find more information about working in the disconnected mode in the "Disconnected Mode" article in the UniDAC documentation.
Therefore, the situation where an I/O error arises is quite expected when removing/inserting a USB drive.
To avoid this, please try to perform the following steps:
- in the UniConnection.OnError event handler set the Fail variable to False in order to avoid the error message;
- set the UniConnection.Options.DisconnectedMode property to True. When setting the property to True, a connection is opened only when it is required and datasets remain open when the connection is closed. Note, that in this case you should not re-open the connection explicitly in the OnError event handler.
You can find more information about working in the disconnected mode in the "Disconnected Mode" article in the UniDAC documentation.