Home>

Task: There is some Java application that needs to be deployed on a remote server. The application works with PostgreSQL. The hosting is already pre-installed Java 11, PostgreSQL 10.3 and Tomcat 9. The application needs to receive a pool of connections.

What caused me difficulties: All examples to create a Tomcat connections pool, which I managed to find, were usually the following steps sequence: Configuring the Tomcat configuration files, configuring Web.xml, receiving DataSource via JNDI . However, based on the fact that Tomcat is already pre-installed, I have some questions and misunderstandings:

  1. Preset Tomcat is likely to be used for completely different applications. Common sense suggests that no one will give me access to the general settings, on which the work of absolutely left applications depends.
  2. When configuring the Connection Pool on the Tomcat side -one of the required attributes that you want to specify this URL connection to the database. In this URL, you must specify the name of the database to which we connect. Those. It turns out that any pool of connections (a separate object of type DataSource) can only be associated with one particular database?

If I'm not mistaken in the two items above, it turns out that the configuration of the compound pool of the built-in Tomcat makes sense only if we ourselves install and configure Tomcat? And if Tomcat is already installed and configured by the admin administrator -how then to be?

p.s. I'm new to this topic.