Two men have been locked up for more than six years after their DNA was found on a gun recovered from a street in Birmingham.