Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with DB pool
    primarykey
    data
    text
    <p>I am using DB pool (<a href="http://www.snaq.net/java/DBPool/" rel="nofollow">DB Pool</a>) in my application. My DAO code is like:</p> <pre><code>static { try { PropertyUtil propertyUtil = new PropertyUtil(); propertyUtil.getBundle(Constants.DB_PROPERTIES); String dburl = propertyUtil.getProperty("dburl"); String dbuserName = propertyUtil.getProperty("dbuserName"); String dbpassword = propertyUtil.getProperty("dbpassword"); String dbclass = propertyUtil.getProperty("dbclass"); String dbpoolName = propertyUtil.getProperty("dbpoolName"); int dbminPool = Integer.parseInt(propertyUtil .getProperty("dbminPool")); int dbmaxPool = Integer.parseInt(propertyUtil .getProperty("dbmaxPool")); int dbmaxSize = Integer.parseInt(propertyUtil .getProperty("dbmaxSize")); Class.forName(dbclass).newInstance(); moPool = new ConnectionPool(dbpoolName, dbminPool, dbmaxPool, dbmaxSize, dburl, dbuserName, dbpassword); moLogWrapper.info("Connection pool size: -"+Integer.valueOf(moPool.getSize())); } catch (ApplicationException aoAppEx) { moLogWrapper .error(aoAppEx.getMessage(), aoAppEx.fillInStackTrace()); new ApplicationException(aoAppEx.getMessage(), aoAppEx.fillInStackTrace()); } catch (IllegalAccessException aoIllEx) { moLogWrapper .error(aoIllEx.getMessage(), aoIllEx.fillInStackTrace()); new ApplicationException(aoIllEx.getMessage(), aoIllEx.fillInStackTrace()); } catch (ClassNotFoundException aoCnfEx) { moLogWrapper .error(aoCnfEx.getMessage(), aoCnfEx.fillInStackTrace()); new ApplicationException(aoCnfEx.getMessage(), aoCnfEx.fillInStackTrace()); } catch (InstantiationException aoIEx) { moLogWrapper.error(aoIEx.getMessage(), aoIEx.fillInStackTrace()); new ApplicationException(aoIEx.getMessage(), aoIEx.fillInStackTrace()); } } </code></pre> <p>and my openConnection() method is :</p> <pre><code>public void openConnection() throws ApplicationException { moLogWrapper.info("inside openConnection method"); try { loCon = moPool.getConnection(); // moLogWrapper.info(moPool.getSize()); } catch (SQLException aoSqlEx) { moLogWrapper .error(aoSqlEx.getMessage(), aoSqlEx.fillInStackTrace()); if (null != loCon) { loCon = null; } throw new ApplicationException(1002, aoSqlEx); } catch (Exception aoEx) { moLogWrapper.error(aoEx.fillInStackTrace()); throw new ApplicationException(aoEx.getMessage(), aoEx.fillInStackTrace()); } moLogWrapper.info("exiting openConnection method"); } </code></pre> <p>The problem is that I am getting null in .openConnection method from Connection pool class. There is a DEBUG log printed in my logs as well, which prints following line:</p> <pre><code>[snaq.db.ConnectionPool.sp] sp: Checkout - 10/10 (HitRate=40.186916%) - null returned </code></pre> <p>I am not able to understand why null is being returned and how can i debug the actual issue.</p> <p><strong>Edit:</strong></p> <p>My application runs fine but throws starts throwing this error sometime suddenly.</p> <p>I am using postgres as my database.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload