complete db base function