Hi Masood,
what kind of error(s) do you get?
I have myself had some trouble setting up a DB pool for SQL Server 2000 at work
following the guides but did not experience any problems setting up a pool for MySQL
back home.
/Thomas
Masood Reyhanei Hamedani <[EMAIL PROTECTED]>
22-04-2004 14:01
Besvar venligst til "Tomcat Users List"
Til: [EMAIL PROTECTED]
cc:
Vedr.: Connection pooling
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�
<FONT SIZE=1 FACE="Arial">_______________
Vi g�r opm�rksom p�, at denne e-mail kan indeholde fortrolig information. Hvis du ved
en fejltagelse modtager e-mailen, beder vi dig venligst informere afsender om fejlen
ved at bruge svar-funktionen. Samtidig beder vi dig slette e-mailen i dit system uden
at videresende eller kopiere den.
Selv om e-mailen og ethvert vedh�ftet bilag efter vores overbevisning er fri for virus
og andre fejl, som kan p�virke computeren eller it-systemet, hvori den modtages og
l�ses, �bnes den p� modtagerens eget ansvar. Vi p�tager os ikke noget ansvar for tab
og skade, som er opst�et i forbindelse med at modtage og bruge e-mailen.
_______________
Please note that this message may contain confidential information. If you have
received this message by mistake, please inform the sender of the mistake by sending a
reply, then delete the message from your system without making, distributing or
retaining any copies of it.
Although we believe that the message and any attachments are free from viruses and
other errors that might affect the computer or IT system where it is received and
read, the recipient opens the message at his or her own risk. We assume no
responsibility for any loss or damage arising from the receipt or use of this message.
</FONT>