Test database code