You can use Tomcat as a container for this if you really want, but what you are running within it is not really a servlet.
Create a servlet with no "getXXX" methods, just an "init"; mark it as "load-on-startup" in the deployment descriptor, and don't assign it to a URL path. That will get you a class which is loaded, instantiated and initialised whenever Tomcat starts but will never be called by a web request. In the "init" method of this class, start a new
Thread and immediately return from init leaving your new thread running.
In your new thread you are free to write any code you like - go to sleep for a bit, wake up, check the time, if it's time to do something, do it and then go back to sleep.
But in all honesty, there's not a lot of reason to do this inside Tomcat. You might as well write a simpler class with a "main" that also starts a thread (but waits for the the thread to complete before returning) doing the same stuff. Then just run it from the command line and leave it running.
Or you could write an even simpler program that just does your DB access then finishes. You can run run this program when needed under the constrol of "cron" or whatever task scheduler is provided by your Operating System.
Has any of that helped?