Consering the fair analisys of Charles, we decided to move applications
to Poolable connection factory
To do so I created a factory iun server.xml as follow:
<Resource name="jdbc/crm" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/crm">
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@1.2.3.4:1521:SID</value>
</parameter>
<parameter>
<name>user</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>60</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.OracleDriver</value>
</parameter>
</ResourceParams>
and in web.xml of the app, I added at the end:
<resource-ref>
<description>
Database connection pool
</description>
<res-ref-name>jdbc/crm</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When trying to connect to the application. Login succeed but I get the
following errors in catalina.out:
org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (invalid argument in call)
Did i miss something in xml definitions or is it a problem with the way
the app uses the connection Pool?
regards
Le jeudi 26 août 2010 à 22:04 -0500, Caldarale, Charles R a écrit :
> > From: Alexandre Chapellon [mailto:[email protected]]
> > Subject: Re: pick load
>
> > To me this sounds like a pool of database connection
> > that is full
>
> It's not a full connection pool - you're not using one. It's also likely
> that your database is a bit sluggish in establishing connections. That
> version of the JVM sets a global lock while creating a connection, with the
> expectation that it will occur fairly quickly, allowing the next connection
> to be established. Note that this has nothing to do with Tomcat.
>
> > I don't really know how/where to deal with it.
>
> Fix your DB, and configure a connection pool rather than calling
> com.mana.oc.DBConnection.getConnectionCRM directly, so each request doesn't
> have to acquire a new connection. Also upgrade to supported versions of
> things, since both the level of Tomcat you're on and the JVM have been
> unsupported for quite some time. The most recent JVMs do not keep that
> particular global lock up on the connection request to the DB, so moving to
> Java 6 might help.
>
> > If someone has the kind willing to take a look at the
> > full dump here it is: http://pastebin.com/2v3PVTDm
>
> A brief look showed only one thread having an active DB connection, with all
> of the rest stuck on the global lock trying to get a connection in order to
> authenticate the client or else just waiting for something to do. Since
> you're not using a connection pool for the authentications, you're
> serializing the requests, so it's no wonder your throughput is terrible.
> Even the greatly improved performance of newer Tomcat and JVM versions won't
> overcome bad webapp design.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>