Change main datastore from application login screen

I am trying to determine the best way to change the main datastore URL from inside the login screen. The application provides a list of “project directories” you can choose from on the login screen. Based on the selection, I would like to startup the datastore using the URL that was selected ( all the project directories are the same layout, just the content in the database is different) Not quite sure how to do this. I appreciate any help or direction.

Is it a single-user application?
If not, how it should work for different users?

Single user application. I thought about writing a loader app and passing the db connection string as a parameter but i would like to keep it all in the browser the UI is consistent .

I would try to make something based on AbstractRoutingDataSource, for example as described in this article: Multitenancy: Switching Databases at runtime with Spring

That looks like it will work well. Thanks.