mardi 16 mai 2017

Handling dynamic database connections in Java

I'm trying to build some dashboard application which allows the user to connect to their database and run queries. The resultset then will be feed into the charts for rendering. I want to understand few things:

  1. As you could guess, each user might have different database sources configured, which I will store in my database. Lets say when 100 users are logging to my application and trying to build up a dashboard. Now I would end up opening 100 connection at the same time (for each user as per their database connection details), which I guess is really bad.

  2. At the same time, I cannot create database connection pool (when my application starts up for each user's database source), as I won't be sure whether which user will pick up their database configuration to build a dashboard. Again I might end up in creating pool which may not be used at all!

How we can handle the same?

Aucun commentaire:

Enregistrer un commentaire