What is the difference between Tomcat JNDI and Spring / Hibernate DS based on pooling

I studied the connection pool parameters, and it is somewhat unclear to me what the differences are in the Tomcat JNDI connection pool compared to the Spring / Hibernate solution.

While it is possible to achieve consolidation using 1 , 2 , the specific application that we have will be better for us to use Tomcat, taking into account the limitations that we have.

Reading, there is a suggestion just to stick with Spring / Hibernate .

Are there any noticeable differences that are worth mentioning between each approach? What is another personal experience of one or the other (or both) - I have successfully used Spring / Hibernate for many years.

+4
source share
1 answer

Both approaches are complementary, not mutually exclusive. On production systems like Spring / Hibernate, they will get a link to the connection pool from the application server as javax.sql.DataSource , usually looking for it in the JNDI tree. It is generally considered the “job” of a server application to manage the connection pool and its connections.

Remember that JNDI is just a place to register objects for sharing, it in itself provides the mandate of any connection pool mechanism. The application server creates and configures the pool, and applications (through Spring / Hibernate / other) use it.

This is also true for applications for setting up and managing a connection pool. This means that the application requires a bit more work, although it relies less on the application server.

+3
source

Source: https://habr.com/ru/post/1302799/


All Articles