I built a Swing application that works with an MSAccess database. I have various buttons to click when clicked–they will disconnect and unlock the database.
Sadly, this is only in a perfect world where users will actually use those buttons and not the little red “x” on the upper right. When some users click that, the database stays locked with a file extension ‘.ldb’ for those of you unfamiliar with MSAccess.
I need to avoid that. Is there any function that I can implement? Like a timeout? I looked up the
DriverManager.setLoginTimeout(10);
method, but that seems to be for login attempts. Is there something for my criteria?
Thanks.
PS: Sadly, i can’t use any other database.
Advertisement
Answer
Sadly, this is only in a perfect world where users will actually use those buttons and not the little red “x” on the upper right.
See Closing an Application. You can create an Action that can be invoked when you use a button, menu item or when the user clicks on the “X” (close) button.