working database example code