Test database connection