code: public synchronized void connect_db() {
  
  	//
  	// Try to connect to the database
  	//
  
  	if (_daemon == true) {
  	    boolean connected = false;
  	    while (connected == false) {
  		try {
  		    db = ApiUtil.get_db_obj();
  		    if (db == null) {
  			Util.out4.println("Can't contact db server, will try later");
  			try {
  			    wait(_sleep_between_connect * 1000);
  			} catch (final InterruptedException ex) {
  			}
  		    } else {
  			connected = true;
  		    }
  		} catch (final Exception e) {
  		    Util.out4.println("Can't contact db server, will try later");
  		    try {
  			wait(_sleep_between_connect * 1000);
  		    } catch (final InterruptedException ex) {
  		    }
  		}
  	    }
  	} else {
  	    try {
  		db = ApiUtil.get_db_obj();
  		if (db == null) {
  		    System.err.println("Can't build connection to TANGO database server, exiting");
  		    System.err.println("DB server host = " + db_host);
  		    System.exit(-1);
  		}
  
  	    } catch (final Exception ex) {
  		System.err.println("Can't build connection to TANGO database server, exiting");
  		System.err.println("DB server host = " + db_host);
  		System.exit(-1);
  	    }
  	}
  	Util.out4.println("Connected to database");
      }
docs: Connect the process to the TANGO database.
  
  If the connection to the database failed, a message is displayed on the
  screen and the process is aborted