[P3]Adding debug setting to ensure errors are displayed despite server settings.
[P3]Adding SQL error handling.