DataSource for Tomcat web app, Spring and Hibernate

Posted by EugeneP on Stack Overflow See other posts from Stack Overflow or by EugeneP
Published on 2010-04-15T10:09:31Z Indexed on 2010/04/15 10:13 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate