title: Java JDBC connections and Oracle
body: <p>I have a scenario and the question follows</p>
  
  <p>Application server has two connections pools to DB. <code>A</code> and <code>B</code></p>
  
  <p><code>A</code> points to -> <code>DatabaseA</code> -> has <code>128 connections</code> </p>
  
  <p><code>A</code> has Stored Procedures which access tables residing in <code>DatabaseB</code> over the <code>DB link</code></p>
  
  <p><code>B</code> points to -> <code>DatabaseB</code> -> has <code>36 connections</code></p>
  
  <p>Now lets say that Java code calls Stored Proc in <code>DatabaseA</code> by using connection pool <code>A</code>.  This stored proc is getting data over the DB link from <code>DatabaseB</code></p>
  
  <p><strong>Question:</strong></p>
  
  <p>Based on this scenario if we get <code>connection closed</code> errors on the front end. Is it viable to say that even though java is calling the SP (in <code>DatabaseA</code>) from pool A (128) but since the SP is bringing data from <code>DatabaseB</code> it has less amount of connections (36).</p>
  
  <p>Basically I want to know when the data is brought over the DB link like this...does it take away from 36 connections assigned to pool B pointint to DatabaseB?</p>
  
  <p><strong>Exact Exception</strong>
  Exact exception I get is: <code>--- Cause: java.sql.SQLException: Closed Connection</code></p>
  
  <p>Some Stack trace:</p>
  
  <blockquote>
    <p>Caused by: java.sql.SQLException:
    Closed Connection     at
    com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
      at
    com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
      at
    com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
      at
    com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:588)
      at
    com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
      at
    org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:268)
      at
    org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
      at
    org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:219)
      at
    org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:266)</p>
  </blockquote>
  
  <p>Also, I am using iBatis ...so don't have <code>try..catch..finally</code> blocks</p>