Fixed #17601 -- expose underlying db exceptions under py2

Use __cause__ to expose the underlying database exceptions even
under python 2.
Merge pull request #1241 from jaylett/master

Explicit exception chaining for db exceptions by setting __cause__ in py2