Issues in updating database

I have one application for the different client and each client possesses a different database for the same application like database1,database2,… etc.
Now I want to change the default database according to the client suppose the client one login into the application, so the default database configuration now points to the database1, and if client 2 log in the application should be connected to database 2.

How can achieve this, I searched on internet but unable to find the solution.

Can anyone help me with this? Looking forward to hearing from you people soon.

Thanks.

bit old but probably would work in your case: