Originally posted by Philip Pross:
I'm using servlets (on a WINNT)to fetch my data base that is on another server(I'm using a odbc driver). So I execute the startup.bat to connect, but my problem is when there is a backup done on the server where my database is, I lose my connection. I've tried using WinAt with so succuss, but on the other hand I created a class that executes every 12 hours... meaning it calls my shutdown.bat then following my startup.bat . Is it possible there is another way of doing this.
Couldn't you simply catch the exception in your code and have it go into wait loop that would try to reconnect periodically. You could configure both the time between connection attempts and the number of times for it to retry.
Please answer each of the following questions, and let's see if we can figure this out.
1) You bat files simply start and stop your application server that is acting as the container for your servlets?
2) Are you attempting to keep a connection/connections to the database open from the initialization of the servlet to it's destruction?
3) When you say you catch the JDBC exception when the connection is down, do you attempt to recreate it?
I think I can answer all the question simple by saying what I'm using. Its Tomcat 3, so if I want access to my servlets I must execute my servletrunner. And when I know the connection is lost is when I want to login, I send the params to the driver, but when I get the response, its null. Also, if my servletrunner is not connected at all, I get a connection error. I hope this may help you.