import java.util.Timer;
Timer timer = new Timer();
int millis = 1000; //n*1000 millisecond = n second --> n minutes = n*60*1000
timer.schedule(new TimerTask() {
@Override
public void run() {
//what to do
}
}, millis);
timer.schedule(new TimerTask() {
@Override
public void run() {
// Your database code here
}
}, 2*60*1000);
// Since Java-8
timer.schedule(() -> /* your database code here */, 2*60*1000);