better error messages on failed db connection

check for file existence and write access

closes #57