Fixed #17601 -- expose underlying db exceptions under py2

Use __cause__ to expose the underlying database exceptions even
under python 2.