created db open function