factored out function to read plain text DBs