DataSource for Tomcat web app, Spring and Hibernate
- by EugeneP
Web app runs on Tomcat. Datasource is configured with Spring configuration,
and is used by Hibernate.
If we cannot use JNDI, what would you suggest to use as a DataSource?
org.springframework.jdbc.datasource.DriverManagerDataSource will be ok?
It's not very good, but sincerely speaking, it can be used on production server, right?
Just a bit of headache with too frequent connection reopening.
Also, we can use BasicDataSource from Apache.
It's much better of course, but here's the question. IF WE DON'T USE JNDI, THEN:
If every instance of an app will create its own copy of a DataSource, and every DataSource
can have 5 open connections, what do we get?
Num_of_running_apps * Num_of_max_active_connections = max active open connection on a DB for this user?
Second question: from the perspective of Hibernate, is there any difference about what datasource implementation is used? Will it work with no matter what datasource perfectly and in a stable way?