Handles SQLExceptions

SQLException handling is notoriously hairy,
so we try our best to centralize that handling.