File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Sartup of servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sartup of servlets" Watch "Sartup of servlets" New topic
Author

Sartup of servlets

Philip Pross
Ranch Hand

Joined: Jan 17, 2001
Posts: 76
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.
Thanks Phil
Byron Estes
Ranch Hand

Joined: Feb 21, 2002
Posts: 313
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.
Thanks Phil

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.
Regards,
Byron Estes


Byron Estes<br />Sun Certified Enterprise Architect<br />Senior Consulant<br />Blackwell Consulting Services<br />Chicago, IL<br /><a href="http://www.bcsinc.com" target="_blank" rel="nofollow">www.bcsinc.com</a>
Byron Estes
Ranch Hand

Joined: Feb 21, 2002
Posts: 313
Also, you might question why you are trying to maintain a constant connection instead of creating when you need it and simply generating a error to the user when the database is not available.
Regards,
Byron Estes
chanoch wiggers
Author
Ranch Hand

Joined: May 24, 2001
Posts: 245
can you check the connection and if it is closed, open a new one?


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
Philip Pross
Ranch Hand

Joined: Jan 17, 2001
Posts: 76
Thanks for the fast replys, as for catching the error when the connection is down, I do, but then I must shut it done, then start it up again. As for the creation of the connection, well when I started with servlets I was using jakarta, and as for the program I created, well I did the same configuration as I did for my pc.
thanks
Phil
Byron Estes
Ranch Hand

Joined: Feb 21, 2002
Posts: 313
Philip,
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?
Regards,
Byron Estes
Philip Pross
Ranch Hand

Joined: Jan 17, 2001
Posts: 76
Byron,
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.
Phil
Byron Estes
Ranch Hand

Joined: Feb 21, 2002
Posts: 313
Phil,
Your response didn't really answer the germaine parts of my questions, so unfortunately I don't think there's much I can do to assist you, but best of luck finding a solution to your problem.
Regards,
Byron Estes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sartup of servlets
 
Similar Threads
Do I Still need Startup.bat????
Getting a grip on the parts
no starting up server
Hosting
tomcat is not starting