connections in web application

1

I'm creating a J2EE project, jsf. They have multiple beans and a controller, and the beans access the Database. I am having doubts about how to manage the connection to the database, at the moment I have only one connection, but it does not make sense. I thought of a pool that is thrown by each thread (each client) but I do not know how to manage that pool. Any tips on how to manage the connections in a web application?

What is done now is every query I need to do BD do:

connection.openDBConnection();
ps = conn.getConnection( ).prepareStatement( Constants.updateValue );
....
connection.closeDBConnection();

I do not like the idea of creating a connection per query or a set of queries. Thanks

    
asked by anonymous 08.06.2016 / 12:44

0 answers