[英]What's the difference between Tomcat JNDI based and Spring/Hibernate DS based connection pooling
I have been looking into connection pool options and it is somewhat unclear to me what the differences in Tomcat JNDI connection pool approach is, compared to the Spring/Hibernate solution to the same. 我一直在研究连接池选项,对于我来说,与Spring / Hibernate解决方案相比,Tomcat JNDI连接池方法的差异有点不清楚。
Whilst it's possible to achieve the pooling using either 1 , 2 , the specific application we have would lend itself better to us using Tomcat given the constraints we have. 虽然有可能实现使用任一池1 , 2 ,我们有特定的应用将更好地借给本身我们使用Tomcat给我们有约束。
Reading about, there is some suggestion to just stick with Spring/Hibernate . 读到,有一些建议只要坚持使用Spring / Hibernate 。
Are there any notable differences worth mentioning between each approach? 每种方法之间是否存在值得一提的显着差异? What are other's personal experience of one or the other (or both) - I have successfully been using Spring/Hibernate for years now. 什么是其他人(或两者)的其他个人经历 - 我已成功使用Spring / Hibernate多年了。
The two approaches are complementary, not mutually exclusive. 这两种方法是互补的,而不是相互排斥的。 In production systems, the likes of Spring/Hibernate will obtain a reference to the connection pool from the appserver, in the form of a javax.sql.DataSource
, usually by looking for it on the JNDI tree. 在生产系统中,类似于Spring / Hibernate将以javax.sql.DataSource
的形式从appserver获取对连接池的引用,通常通过在JNDI树上查找它。 It generally considered to be the appserver's "job" to manage the connection pool and its connections. 它通常被认为是appserver的“工作”来管理连接池及其连接。
Remember, JNDI is just a place for registering objects for sharing, it does in itself mandate any given connection pool mechanism. 请记住,JNDI只是一个注册对象以进行共享的地方,它本身就要求任何给定的连接池机制。 The app server creates and configures the pool, and the applications (via Spring/Hibernate/whatever) use it. 应用服务器创建并配置池,应用程序(通过Spring / Hibernate /等)使用它。
It's just as valid, however, for the applications to configure and manage the connection pool themselves. 但是,对于应用程序来说,配置和管理连接池本身也同样有效。 This does mean a bit more work for the application, though, with less reliance on the appserver. 但这对应用程序来说意味着更多的工作,同时减少对应用程序服务器的依赖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.