You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by abjett <rj...@austin.rr.com> on 2003/04/08 19:01:10 UTC
DBCP - JNDI - Jakarta Connectors
I need to understand more about DBCP, JNDI Jakarta Connectors as it is used
with Tomcat 4...
I used
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html as a starting point...specifically, the MySQL example.
The code works fine but...
I don't understand how, why a "connection pool" is established by the java
code shown in the MySQL example. To me this code looks like it establishes
a connection but not any kind of pool.
Where can I find an explanation of how the pool is established and examples
that use the pool?
Thanks,
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: DBCP - JNDI - Jakarta Connectors
Posted by abjett <rj...@austin.rr.com>.
Yes. The problem I had in the beginning was not setting up a mysql super
user as described.
This is for :
MySQL 4.11 gamma,
Tomcat 4.1,
W2K
If you didn't build a super user as described in the article. You will need
to do that first.
Good Luck,
Bob
The file structure is: C:\Program Files\Apache Group\Tomcat 4.1\webapps\
DBTEST
foo
DBTest.class
WEB-INF
foo
DBTest.class
web.xml
test.jsp
IN YOUR conf/server.xml after the tomcat examples context...
<host> ---- all of this stuff through the end of </context> should
exist already just find the end of the "Tomcat examples context"
...
<!-- Tomcat Examples Context -->
<context...>
...
</context>
--- PUT THE FOLLOWING AFTER THE Tomcat Examples Context ----
<!-- MySQL DBCP test -->
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>javauser</value>
</parameter>
<parameter>
<name>password</name>
<value>javadude</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed
the
connection. mysqld by default closes idle connections after 8
hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
<!-- End MySQL DBCP test -->
---- I HAVE THE MYSQL CONTEXT AS
THIS ---
<!-- MySQLAccess -->
<Context path="/MySQLAccess" docBase="MySqlAccess" debug="0"
reloadable="true" />
<!-- END MySQLAccess -->
</host> ----this is just end of your host, it should already be there.
----- Original Message -----
From: "Jesse Keller" <je...@aya.yale.edu>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, April 08, 2003 12:07 PM
Subject: Re: DBCP - JNDI - Jakarta Connectors
> Bob --
>
> Are you running on Windows by any chance? If you are, please send me your
> server.xml file, so I can try to fix my configuration! I can't get mine to
> work.
>
> Thanks,
>
> Jesse
>
> ----- Original Message -----
> From: "abjett" <rj...@austin.rr.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Tuesday, April 08, 2003 1:01 PM
> Subject: DBCP - JNDI - Jakarta Connectors
>
>
> > I need to understand more about DBCP, JNDI Jakarta Connectors as it is
> used
> > with Tomcat 4...
> > I used
> >
>
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
> > to.html as a starting point...specifically, the MySQL example.
> > The code works fine but...
> >
> > I don't understand how, why a "connection pool" is established by the
> java
> > code shown in the MySQL example. To me this code looks like it
> establishes
> > a connection but not any kind of pool.
> >
> > Where can I find an explanation of how the pool is established and
> examples
> > that use the pool?
> >
> > Thanks,
> > Bob
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: DBCP - JNDI - Jakarta Connectors
Posted by Jesse Keller <je...@aya.yale.edu>.
Bob --
Are you running on Windows by any chance? If you are, please send me your
server.xml file, so I can try to fix my configuration! I can't get mine to
work.
Thanks,
Jesse
----- Original Message -----
From: "abjett" <rj...@austin.rr.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Tuesday, April 08, 2003 1:01 PM
Subject: DBCP - JNDI - Jakarta Connectors
> I need to understand more about DBCP, JNDI Jakarta Connectors as it is
used
> with Tomcat 4...
> I used
>
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
> to.html as a starting point...specifically, the MySQL example.
> The code works fine but...
>
> I don't understand how, why a "connection pool" is established by the
java
> code shown in the MySQL example. To me this code looks like it
establishes
> a connection but not any kind of pool.
>
> Where can I find an explanation of how the pool is established and
examples
> that use the pool?
>
> Thanks,
> Bob
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org