1 Reply Latest reply on Sep 5, 2008 12:10 PM by Peter Johnson

    Best Practices - data source / pooling configuration

    Jan Andersson Newbie

      Hi all,

      I have a couple of questions about JBoss and data source configuration (connection pooling).

      We are planning to run 5-10 applications in our JBoss instance. They will all be working with the same database schema. That means we could setup one data source and all apps shared it.

      I'm guessing that would be the most efficient but not the safest, for example say if one app is leaking connections.

      Another think is managing the data source definitions. Thinking one -ds.xml file rather than one per app is the way to go. That way the admin is in charge of it and not the dev teams.

      What are your thoughts about data source / pooling configuration in JBoss?
      What I'm after is some kind of best practices surrounding this. Any input appreciated!

      Thanks!

        • 1. Re: Best Practices - data source / pooling configuration
          Peter Johnson Master

          The single data source is, in my opinion, the better option.

          Having a single data source enables the app server to better manage the available connections to the database. With a multiple data sources, you would have to determine the connection allowances for each app and enable that many connections in the database. If one app was not using all of its connections but another was, and that second app needed more connections, they would not be available. With a single data source this would not occur.

          If you are concerned about leaking connections, see http://wiki.jboss.org/wiki/CanJBossTellMeWhenIDontCloseAConnection

          However, each app should be developed to assume its own data source - it is the administrator whoe deploys the apps who would hook them up to the same data source by mapping the name the apps use for the data source to the same JNDI name of the data source.