Added sql error handling.
Merge pull request #11 from madgloryint/sql-error-handling

Added sql error handling.