How to verify whether a connection pool has beem set up in spring MVC web app?
<p>In one of my question asked earlier I got to know that <code>DriverManagerDataSource</code> is <strong>NOT</strong> intended for production use. So I changed my configuration. I know I am using DBCP which is also outdated and a lot of other connection pools are available like HIkariCP and BOneCP but </p>

<blockquote>
  <p>I wish to understand the way how to verify that a pool has been setup
  or not?</p>
</blockquote>

<p>On searching a lot I got some answer at the following link <br>
<a href="https://stackoverflow.com/questions/5134515/how-would-you-test-a-connection-pool">How would you test a Connection Pool</a></p>

<p>but I didn't get a way to verify programmatically. Also I cannot debug my jar files used for connection pooling because no source code is available. I dont know why but I can't change my jars for offical reasons.</p>

<p>The following are my configuration (OLD and NEW)<br/></p>

<p><strong>OLD</strong> </p>

<pre><code>&lt;bean id="webLogicXADataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
        &lt;property name="driverClassName" value="#[csa.db.driver]" /&gt;
        &lt;property name="url" value="#[csa.db.url]" /&gt;
        &lt;property name="username" value="#[csa.db.username]" /&gt;
        &lt;property name="password" value="#[csa.db.password]" /&gt;     
    &lt;/bean&gt;
</code></pre>

<p><strong>NEW</strong>
Using DBCP connection pool <br></p>

<pre><code>&lt;bean id="webLogicXADataSource"
        class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
        &lt;property name="driverClassName" value="#[csa.db.driver]" /&gt;
        &lt;property name="url" value="#[csa.db.url]" /&gt;
        &lt;property name="username" value="#[csa.db.username]" /&gt;
        &lt;property name="password" value="#[csa.db.password]" /&gt;     
    &lt;/bean&gt;
</code></pre>

<p><strong>OTHER ELEMENTS:</strong>(Thus far I have kept them same like they were earlier)<br></p>

<blockquote>
  <p>Place holder</p>
</blockquote>

<pre><code>&lt;bean id="placeholderConfig"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
        &lt;property name="locations"&gt;
            &lt;list&gt;              
                &lt;value&gt;file:${DB_PROPERTIES}&lt;/value&gt;                
            &lt;/list&gt;
        &lt;/property&gt;
        &lt;property name="placeholderPrefix" value="#[" /&gt;
        &lt;property name="placeholderSuffix" value="]" /&gt;
    &lt;/bean&gt;
</code></pre>

<blockquote>
  <p>Transaction Manager</p>
</blockquote>

<pre><code>&lt;bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
        &lt;property name="dataSource" ref="webLogicXADataSource" /&gt;
        &lt;qualifier value="inventoryTxManager"/&gt;
    &lt;/bean&gt;
</code></pre>

<blockquote>
  <p>DAOIMPL SAMPLE BEAN</p>
</blockquote>

<pre><code>&lt;bean id="inventoryDao"
        class="com.lxnx.fab.ce.icce.inventoryRoutingInvoice.dao.InventoryDaoImpl"&gt;
        &lt;property name="dataSource" ref="webLogicXADataSource" /&gt;
        &lt;property name="transactionManager" ref="transactionManager" /&gt;
</code></pre>

<p></p>

<p>Right now all the DAO classes in my project are singleton(no prototype property set for any of the beans)</p>

<p>The following is the sample java code of the DAOImpl.java class where I need to do all the transactions:</p>

<p><strong>DAOImpl.java</strong> <br/></p>

<pre><code>public class InventoryDaoImpl implements InventoryDao {
    private final static ISmLog iSmLog = Instrumentation
            .getSmLog(LNConstants.SYSTEM_LOG_NAME); 

    private JdbcTemplate jdbcTemplate;

    private DataSource dataSource;

    private PlatformTransactionManager transactionManager;

    public void setDataSource(DataSource dataSource) {
        this.jdbcTemplate = new JdbcTemplate(dataSource);
        this.dataSource = dataSource;
    }   

    public void setTransactionManager(
            PlatformTransactionManager transactionManager) {
        this.transactionManager = transactionManager;
    }

@Transactional private void insertRelatedInfoData(
        InventoryModel inventoryModel) {
            final List&lt;String&gt; relatedLniList = inventoryModel.getArrRelatedLni();                  
            final String documentLni  = inventoryModel.getDocumentLNI();        
            String sql = "INSERT INTO SCSMD_REPO.INV_RELATED_INFO(LNI, RELATED_LNI) VALUES(?,?)";
            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
                @Override
                public void setValues(PreparedStatement ps, int i) throws SQLException {
                    String relatedLni = relatedLniList.get(i);
                    ps.setString(1, documentLni);
                    ps.setString(2, relatedLni);            
                }
                @Override
                public int getBatchSize() {
                    return relatedLniList.size();
                }
              });   
    }

}
</code></pre>

<p>I am not getting any errors. Just wanted to verify If a pool has been setup U wish to verify the same</p>

<p>Are all configurations fine or did I miss something?? Please help me out with you valuable answers. thanks</p>