# How to reconnect Database at device server startup time

Intended audience: advanced developers, Programming language: c++

This HowTo is a CPP example of how you can program a Tango DS in order that it can be started before the Tango’s database and which will wait for the Tango database to start.

Add the following lines at the beginning of the main method (File main.c):

    1 //  Set an automatic retry on database connection
    2    //---------------------------------------------------
    3    Tango::Util::_daemon = true;
    4    Tango::Util::_sleep_between_connect = 5;

The device server will retry to connect database in case of failure periodicaly (every 5 seconds in example).