Dear all
I have a problem in using Connection Pooling with Tomcat 5.0.19, that is working in
version 4.1.18 so good.I am using that configuration with 5.0.19 but it doesn't work
att all.
I configure the ROOT.xml in this way:
<?xml version='1.0' encoding='utf-8'?>
<Context cachingAllowed="true" crossContext="true" debug="0" docBase="/ROOT" path=""
privileged="false" reloadable="true" swallowOutput="false" useNaming="true">
<Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs"
prefix="localhost_ROOT_log." suffix=".txt" timestamp="true" verbosity="1"/
<Resource auth="Container" name="jdbc/UKwebpooling" scope="Shareable"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/UKwebpooling">
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/university?autoReconnect=true</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>myusername</value>
</parameter>
<parameter>
<name>password</name>
<value>mypassword</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>0</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
</ResourceParams>
</Context>
and create a java class such as this:
package pooling;
import javax.sql.*;
import javax.naming.*;
import java.sql.*;
public class webPooling
{
Connection mySqlConnection = null;
public webPooling() //Class constructor
{
}
public void init() //Connection Creator
{
try
{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("ERROR IN CONTEXT INITIALIZATION!!?");
DataSource mySqlDatasource =
(DataSource)ctx.lookup("java:comp/env/jdbc/UKwebpooling");
if(mySqlDatasource == null)
throw new Exception ("ERROR IN DATASOURCE CREATING");
else
mySqlConnection = mySqlDatasource.getConnection();
}//try
catch(Exception e)
{
e.printStackTrace();
}
}
public Connection getConnection()
{
return mySqlConnection;
}
}
I guess the problem is in common-dbcp-1.1 and common-pool-1.1 .jar files .
Is there any one that know about this problem?
With Thanks.
Masood.
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�