commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Allen <tofer5_jaka...@yahoo.com>
Subject DBCP: Config in Struts
Date Wed, 05 Mar 2003 19:18:16 GMT
All,

I am having trouble utilizing DBCP in Struts 1.0.2.

My datasource tag in struts-config.xml looks something
like this:

------------

<data-source key="conPool"
type="org.apache.commons.dbcp.BasicDataSource">
    <set-property
      property="driverClassName"
      value="oracle.jdbc.driver.OracleDriver" />
    <set-property
      property="url"
      value="jdbc:oracle:thin:@{mydomain
here}:1521:{my sid here}" />
    <set-property
      property="username"
      value="xxxxxxx" />
    <set-property
      property="password"
      value="xxxxxxx" />
    <set-property
      property="maxActive"
      value="25" />
    <set-property
      property="maxIdol"
      value="6" />
    <set-property
      property="maxWait"
      value="-1" />
    <set-property
      property="removeAbandoned"
      value="true" />
    <set-property
      property="removeAbandonedTimeout"
      value="60" />
    <set-property
      property="defaultAutoCommit"
      value="false" />
    <set-property
      property="defaultReadOnly"
      value="false" />
    <set-property
      property="validationQuery"
      value="select SYSDATE from dual" />

</data-source>

---------------

I access the datasource by doing the following:

+++++++++++++++

// all of my actions have this equivalent
    DataSource ds = servlet.findDataSource("conPool");

    try {
        con = ds.getConnection();
        LogonDAO logonDAO = new LogonDAO(con);
        // the DAO object use the con for
PreparedStatements
        user = logonDAO.logon(pUser);
    }
    catch(Exception e) {
        throw e;
    }
    finally {
        try {
            con.close()
        }
        catch(SQLException sqle) {
            throw sqle;
        }
    }

+++++++++++++++

When I loadtest with JMeter, and assign 3 Virtual
Users, it will open no more than 1 db connection per
user (3 conns).  Needless to say, its slow, and their
doesn't seem to be much pooling going on.

It must be a config issue.  Where is a standard
dbcp/struts example?

Thanks in advance,

Chris


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Mime
View raw message