Db driver refactoring
Improved debug messages, modified RestException that was not using debug parameter.