You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by abhishek srivastava <ab...@hotmail.com> on 2002/06/09 16:56:50 UTC
Connection pooling doesn't work for me ... Help !!
Hello everyone,
I read the tomcat jndi how to manual. searched the mailing list archive. and
did everything which has made other happily get a connection from the jndi
of the pool but I just can't do it.
DataSource ds = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/MPSSource");
return ds.getConnection(); ///// RETURNS NULL !!
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Connection pooling doesn't work for me ... Help !!
Posted by Martin Jacobson <ma...@libero.it>.
anthony.dodd wrote:
> Hi
>
> I've posted a solution see "Generic DataSource Resource Factory
> Available. JDBC Data Source" on the tomcat user maillist.
>
> Tony
>
Yes, but...
Like many others on this list, I too have been unable to get the std
JNDI DataSource thingy working; as an interim measure, I implemented a
workaround (which does at least work!), but I refuse to be defeated!
My understanding is that the standard naming factory wotsit is "Tyrex" -
if I implement Anthony Dodd's offering, do I chuck out Tyrex?
My latest attempt is based on the suggestions offered by Les Hughes,
which uses the Jakarta Commons DBCP, collections, and pool libraries.
However, when I run my application, I get the (by now, all too familiar)
following exception thrown:
2002-06-13 13:37:15 static: Error!
javax.naming.NamingException: Exception creating DataSource:
org.hsql.jdbcDriver
at
org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:227)
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:165)
at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:835)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.terma.martin.drs.StaticPage.handleRequest(Unknown Source)
at
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:331)
at
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:292)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
It seems as though Tyrex is trying to use org.hsql.jdbcDriver, which I
don't want - I'm using MySQL - or am I not interpreting the stack trace
properly?
Here is the relevant part of server.xml:
<Resource name="jdbc/RadiationDB"
auth="Container"
type="javax.sql.DataSource"/>
<Resource-params name="jdbc/RadiationDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name><value>100</value>
</parameter>
<parameter>
<name>maxIdle</name><value>30000</value>
</parameter>
<parameter>
<name>maxWait</name><value>100</value>
</parameter>
<parameter>
<name>user</name>
<value>me</value>
</parameter>
<parameter>
<name>password</name>
<value>secret!</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/radiation</value>
</parameter>
</Resource-params>
My configuration is:
Tomcat 4.0.4b1
mm.MySQL 2.0.12
latest DBCP from nightly build
mySQL 3.23.46
running on Mac OS X (10.1.5) JDK 1.3.1
All suggestions gratefully received!
Thanks,
Martin
PS Sorry about the length of the post :-(
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Connection pooling doesn't work for me ... Help !!
Posted by "anthony.dodd" <an...@ntlworld.com>.
Hi
I've posted a solution see "Generic DataSource Resource Factory
Available. JDBC Data Source" on the tomcat user maillist.
Tony
----- Original Message -----
From: "abhishek srivastava" <ab...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Sunday, June 09, 2002 7:56 AM
Subject: Connection pooling doesn't work for me ... Help !!
> Hello everyone,
>
> I read the tomcat jndi how to manual. searched the mailing list archive.
and
> did everything which has made other happily get a connection from the jndi
> of the pool but I just can't do it.
>
> DataSource ds = (javax.sql.DataSource)
> initCtx.lookup("java:comp/env/jdbc/MPSSource");
> return ds.getConnection(); ///// RETURNS NULL !!
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>