Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> connection pooling exception

connection pooling exception

From: Chris <chris.lo_at_cyberwisdom.net>
Date: Thu, 6 Dec 2001 10:31:41 +0800
Message-ID: <9umjct$9a6$1@tenorhorn.hk.dyxnet.com>


Hi,

I am using java servlet and Oracle 8.1.6 database. I used the OracleConnectionCacheImpl class to achieve connection pooling. However, sometimes the application server will output the following exception. Is it becase that the pool is used up for any other reason? Any other better practice to do connection pooling using servlet?

Thanks.
Chris

Exception:



<2001-12-1 12:45:23> <Error> <HTTP>
<[WebAppServletContext(661879,DefaultWebApp_wbserver)] Servlet failed with Exception
java.util.EmptyStackException
 at java.util.Stack.peek(Stack.java:82)
 at java.util.Stack.pop(Stack.java:64)
 at
oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCac heImpl.java:183)
 at
oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection(OracleConnectionCac heImpl.java:157)
 at cwSQL.openDB(cwSQL.java:153)
 at aeAction.service(aeAction.java:101)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)  at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :213)
 at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:1265)
 at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1631)
 at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)  at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Servlet class cwSQL Source Code :



public class cwSQL
{

    private static OracleConnectionCacheImpl ods = null;

    public void cwSQL() {;}

    public Connection openDB() {

                if (ods == null) {

// Create a OracleConnectionPoolDataSource as an factory
// of PooledConnections for the Cache to create.
OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource(); ocpds.setURL("jdbc:oracle:thin:@"+ dbHost + ":" + dbPort + ":" + dbName); ocpds.setUser(usrNm); ocpds.setPassword(usrPw);
// Associate it with the Cache
ods = new OracleConnectionCacheImpl(ocpds);
// Set the Max Limit
ods.setMaxLimit (20); } con = ods.getConnection();
    }
} Received on Wed Dec 05 2001 - 20:31:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US