I am currently working on converting our client/server application from an MS Access database to using Derby. We have approximately 40 sites that use our software and each one can have from 1 to 10 client computers that connect to the central database.
The latest issue I have come across is how to handle the application and database upgrades at our client sites.
Our current process is automated and works like this: 1. Check on our website to see if there is a new release available 2. If there is a new release available, download the new client application and the scripts to upgrade the database 3. Determine if anyone is currently connected to the database prior to performing the upgrade so we are not altering tables while someone is doing work. 4. If anyone is connected to the database we abort the upgrade and inform the user that they should make sure all other users are disconnected before performing the upgrade. 5. If there are no users connected to the database then we rename the Access file so that no users can connect to the database while we're performing the upgrade. 6. Perform the database upgrade. 7. Rename the Access database file back to it's original name so it is available for use again. 8. Upgrade the client application files.
Currently we are able to determine if anyone is connected to the Access database by just trying to rename the .mdb file. If this fails then the database is in use. I have been unable to find a good way to determine if there are any users currently connected to the Derby database. I have found mentions of calling NetworkServerControl runtimeinfo and looking at the Active Sessions, but I don't know of a way to call that function and return the Active Sessions results to the installer program that I am using (Indigo Rose TrueUpdate).
Is there any other method for determining the number of users that are currently connected to a Derby database?
Also, is there a way to lock the database so that no users can connect to it while the upgrade is being performed?
Is there anyone else that has a similar type of situation, and how did you handle it?