Failed to read from or write to database. Refresh and try again.
This is one of those errors that is worded in such a way that it completely throws you off the scent, at least in the situation we are talking about here. Taken at face value it looks like a database permissions problem. The whole of the message reads "Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator". It's a pretty good guess that if you refresh and try again you will indeed find that the problem persists. You will probably double check that you have termstore administrator permissions. And it will persist even if you open up the managed metadata database to give "everyone" db_destructor permissions. Time to contact the administrator... who would that be?
I have encountered this when there is something wrong with the terms I am trying to add. For example I try to create a term that already exists, although it might not look as though it exists. Sometimes terms can get orphaned in the database in such a way that the Guid can't be used again. You might find an error in the ULS saying "Cannot insert duplicate key row in object...". If you are sure the term doesn't already exist the easy solution is to use a new Guid (I suppose it is more of a workaround than a solution).
One suggested possible cause is that there are uncommited transactions. Perhaps you added a term and didn't do a CommitAll, or perhaps the script didn't run to completion. In that situation you could try using the RollbackAll() method on the termstore object.
You might also encounter this when trying to create or modify a managed metadata site column. It's the same kind of thing - the Guid already got used in the managed metadata database. It is really nothing to do with your application's ability to read from or write to the database, except in so far as that you can't do it because the Guid is already in use. I suppose in an ideal world the error message would say something like "the Guid is already in use" or something, but that would be rather like handing the answer to you on a plate. Where's the challenge in that?