I have a peculiar problem I'm hoping someone can help with. First, let me explain how it works now and then I'll explain what the client wants to do differently. I have a servlet which in it's init() method opens a single connection to a database. Each service() method uses this connection to run a query. The destroy() method closes the connection when the web server (JWS on Win2000) shuts down. The client would like to run maintenance on the datbase every night and this requires exclusive use of the database. The only way to release the servlet's connection is to shut down the web server. Obviously, this is not ideal. Also, the client does not want the hassle of running a duplicate database for several reasons, not the least of which is the shear size of the files. The client has asked for a GUI application that they can click on that closes the connection and causes web site users to see "Database down - please come back in 5 minutes" or a similar message. After maintenance, they can click on a button and resume normal operation. Can this be done? Can I launch a GUI from a servlet's init() and have that GUI control the connection? If not, any other ideas? (I have a sneaky suspicion I'm missing something VERY obvious) Your help is greatly appreciated! Arsin Delve.
You ARE missing something obvious! Add some logic inside the servlet to look for an undocumented URI that does the lock/unlock. Secure this URI by refusing to process it unless objective proof is given that the user is authorized. If the "magic" URI is supplied AND the security is OK'd, invoke the lock/unlock function. Non-magic URI's go through the normal processing, and you can toss back a suitable status code for unauthorized magic URI's. Why write a GUI when the user's web browser is a GUI?
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 08, 2001
I had to read that about 4 times to understand whay you meant, but once I did I thought it was terrific! What a great idea, thanks so much! I think I understand URI from the context, but what does it mean? Did you rather mean URL? -Arsin Delve.