It seems that the two databases are clashing, ie, it connects to the one for the CMS, then connects to the one for the availability calendar, then can't load the CMS one as it's stuck loaded to the availability calendar database. I think there's something obvious that I'm missing, I've checked the config files of both and they seem correct.
Ah, this is a different issue.
If you want the code to connect to 2 databases you will need to modify the code where it makes a mysql query (update, alter, fetch etc.) to use the specific db connection. I would suggest connecting to the calendar database first and *just* modifying the calendar code as no doubt the CMS code is more complex.
However, why not move the calendar tables into the main database? This way you would only need one connection.
Chris