Added tests for DatabaseException
Added some functional tests.