Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 745691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:36:45+00:00 2026-05-14T09:36:45+00:00

Web app runs on Tomcat. Datasource is configured with Spring configuration, and is used

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T09:36:46+00:00Added an answer on May 14, 2026 at 9:36 am

    If we cannot use JNDI, what would you suggest to use as a DataSource?

    Certainly not org.springframework.jdbc.datasource.DriverManagerDataSource in production, this class is just not a connection pool as written in the javadoc:

    NOTE: This class is not an actual connection pool; it does not actually pool Connections. It just serves as simple replacement for a full-blown connection pool, implementing the same standard interface, but creating new Connections on every call.

    Useful for test or standalone environments outside of a J2EE container, either as a DataSource bean in a corresponding ApplicationContext or in conjunction with a simple JNDI environment. Pool-assuming Connection.close() calls will simply close the Connection, so any DataSource-aware persistence code should work.

    Use a standalone connection pool like C3P0 or DBPC. Personally, I would go for C3P0 which is known to behave better than DBCP. Have a look at c3p0 vs. dbcp on the Spring forums and this previous question here on SO.

    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?

    Total # of connections = # of instances of the application x 5

    from the perspective of Hibernate, is there any difference about what datasource implementation is used?

    There is no difference. Hibernate will use the connection it gets from Spring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app which runs in apache tomcat, I have used j_security_check
Sorry for my English. I use Eclipse 3.7 , that runs web-app ( spring-mvc
I have a web app that runs perfectly on Apache Tomcat. However, when I
I have a web app that runs under Tomcat on Windows XP that needs
I have a Maven-built web application that uses Hibernate. It runs successfully in Tomcat,
My web app runs on .Net 3.5, all of the dates are saved on
I have a web app that runs fine in Visual web developer. But when
This isn't a native iPad app. This is a HTML5 web app which runs
I have a web database app that runs in IE7+ (customer requirement) It is
In my mind, a web app something that runs continuously; therefore, I'm confused by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.