I have a simple task to accomplish, but I am not sure what is the best way to go by.
Each user has their own username and password to connect to a database with different privilege. Once the user connect, he will do multiple query base on what action he want to perform. Therefore I want to retain the connection with the database. So here is my question?
Is it better to achieve what I want to do with connection pooling or session or both?
Sample code would be appreciated!!! thank you very much.
Define a container managed connection pooled
DataSourcewith “root” privileges in the server and for each user make use of theDataSource#getConnection()method which takes an username and password as arguments.