work through database_open function