• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sartup of servlets

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you check the connection and if it is closed, open a new one?
 
Philip Pross
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 313
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic