Hi,
I don't see anything in this error that indicates its related to Medium Trust. Usually, medium trust issues manifest as security exceptions.
In mojoPortal when errors occur, the global error handling will check if the schema is installed and if it needs an upgrade, if either is true it will redirect to the /Setup/Default.aspx page. The way it determines if the schema has been installed is by checking for the existence of the mp_Sites table.
This error seems to indicate its failing to execute the sql that is checking for the existence of the mp_Sites table. I have never seen this error before, googling it doesn't find much, I see some speculation that the version of SQL server could be a factor.
My best guess is its being caused by an unresponsive db. I think its probably timeout exceptions. In a situation where the db is intermittently unresponsive I could easily understand this error. So maybe, in addition to being hosted in medium trust, you are hosted on a machine that is running at max capacity.
The reason changing the connection string fixes it for a while is because any time you modify the Web.config file it recycles the application, clearing any memory it is using. Then the application starts again and its ok for a while but because (possibly) the machine is maxed out errors start happening again.
Thats the best theory I have for this at the moment.
Hope it helps,
Joe