There is a simple servlet that performs post / get requests by clicking on various buttons on a JSP page. These buttons call methods that interact with the database (such as adding / reading some values ​​by keys). In the class where the implementation of these methods is presented, a pool of connections to the database is created (c3p0 DataSource).

But when you start the sevlet and trying to just read the values, it swears at this very pool of connections. Those. Writes some type of exepsons - I can not create a pool of connections and everything like that. The same swears on logging ...

Is it necessary to specify this connection pool and logging in web.xml? Are there any examples of how to do this correctly for such projects?

  • Usually such resources as connections to subd manages the container, so this resource is configured in the application server itself. if you create a connection to the subd themselves in the code, then you do it not quite as it should (ie, add a connection pool, or if the driver itself supports the number of connections in the pool). Unfortunately, the subd configuration examples for the server aplication will not be shown. setting will be different for different servers - jmu
  • @jmu usually such resources are managed by that part of the system that is convenient for a specific developer. You should not fool your head with setting up resources in a container. Moreover, to do this from the code is not a problem. - a_gura
  • @drcosmo "some kind of exept" is not a matter of conversation. The code and the glass-set in the studio, and then fortune-telling on the tea leaves comes out. - a_gura

0