Can I change the database name temporarily while running Platform?

What I am trying to do is a kind of multi-tenancy since to have several instances would be too expensive, so I am thinking to change the conection string based on the url for example http://hospital1.website.com/openmrs so on login I would change the connection to database hospital1 if login hospital2 I would change the connection string to hospital2 and so on.

Does it clarify a lit of bit more.