You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Iran Marcius <ir...@isic.com.br> on 2002/12/19 20:09:43 UTC
Problem trying to use JNDI connection pool
I'm trying to configure torque to get datasource from JNDI, but when I
attempt to do something (like "doSelect", for instance), got always the
same error: "Connection object was null"
The database resource is correctly configured in tomcat, since I can
successfully get the Datasource and Connection through a test program I
wrote (getting an initial context and doing a lookup, etc, etc), or
should I mistaken about that?
The relevant portion of my torque.properties is (my database name is
"global"):
## Using jndi
torque.dsfactory.global.factory=org.apache.torque.dsfactory.JndiDataSour
ceFactory
torque.dsfactory.global.jndi.path=java:comp/env
torque.dsfactory.global.jndi.java.naming.factory.initial=org.apache.nami
ng.java.javaURLContextFactory
torque.dsfactory.global.jndi.java.naming.factory.url.pkgs=org.apache.nam
ing
torque.dsfactory.global.datasource.classname=org.apache.torque.pool.Torq
ueClassicDataSource
torque.dsfactory.global.datasource.dataSourceName=jdbc/global
torque.dsfactory.global.datasource.jndiEnvironment.java.naming.factory.i
nitial = org.apache.naming.java.javaURLContextFactory
torque.dsfactory.global.datasource.jndiEnvironment.java.naming.factory.u
rl.pkgs = org.apache.naming
torque.dsfactory.global.datasource.defaultMaxConnections=10
Do I need all this lines? About torque.dsfactory.global.jndi.path and
torque.dsfactory.global.datasource.dataSourceName I already tried a lot
of combinations, and I'm not sure about its values.
Any would be very appreciated.
Thanx.
iran
Re: Problem trying to use JNDI connection pool
Posted by Bill Schneider <bs...@vecna.com>.
the one you want in this case is jndi. jdbc2pool creates a JDBC DataSource
(as opposed to looking up one provided by the app server) and "old
connection pool" is mainly for legacy Torque or Turbine apps.
-- Bill
----- Original Message -----
From: "Iran Marcius" <ir...@isic.com.br>
To: "'Turbine Torque Users List'" <tu...@jakarta.apache.org>
Sent: Friday, December 20, 2002 5:13 AM
Subject: RES: Problem trying to use JNDI connection pool
> By the way, I realized I can configure torque to use "old connection
> pool", "jdbc2 pool", "jndi" and "ConnectionPoolDataSource".
>
> Since I'm a newbie with torque, I'm not sure about which to use or which
> is more appropriate regarding each specific situation. Was it confused?
> :))
>
> iran
>
> -----Mensagem original-----
> De: Bill Schneider [mailto:bschneider@vecna.com]
> Enviada em: quinta-feira, 19 de dezembro de 2002 18:24
> Para: Turbine Torque Users List
> Assunto: Re: Problem trying to use JNDI connection pool
>
>
> Hi,
>
> You might try deleting some of the unnecessary lines from
> Torque.properties... One that works for me only has a handful of lines
>
> ## Using jndi
> torque.dsfactory.global.factory=org.apache.torque.dsfactory.JndiDataSour
> ceFa
> ctory
> torque.dsfactory.global.jndi.path=jdbc/global
>
> Perhaps some of the lines in your config file are interfering with
> Tomcat's
> JNDI context. In particular,
>
> >
> torque.dsfactory.global.jndi.java.naming.factory.initial=org.apache.nami
> > ng.java.javaURLContextFactory
> >
> torque.dsfactory.global.jndi.java.naming.factory.url.pkgs=org.apache.nam
> > ing
>
> You don't want to set up your own initial context... you want to use the
> one
> supplied by Tomcat, because that's where your datasources are bound.
> The
> default config file may occasionally be confusing because there are
> examples
> for both looking up a DS from a JNDI context provided by the app server,
> and
> having Torque create its own JNDI Context and binding a datasource to
> it,
> rather than looking it up.
>
> -- Bill
>
>
> --
> 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>
>
RES: Problem trying to use JNDI connection pool
Posted by Iran Marcius <ir...@isic.com.br>.
By the way, I realized I can configure torque to use "old connection
pool", "jdbc2 pool", "jndi" and "ConnectionPoolDataSource".
Since I'm a newbie with torque, I'm not sure about which to use or which
is more appropriate regarding each specific situation. Was it confused?
:))
iran
-----Mensagem original-----
De: Bill Schneider [mailto:bschneider@vecna.com]
Enviada em: quinta-feira, 19 de dezembro de 2002 18:24
Para: Turbine Torque Users List
Assunto: Re: Problem trying to use JNDI connection pool
Hi,
You might try deleting some of the unnecessary lines from
Torque.properties... One that works for me only has a handful of lines
## Using jndi
torque.dsfactory.global.factory=org.apache.torque.dsfactory.JndiDataSour
ceFa
ctory
torque.dsfactory.global.jndi.path=jdbc/global
Perhaps some of the lines in your config file are interfering with
Tomcat's
JNDI context. In particular,
>
torque.dsfactory.global.jndi.java.naming.factory.initial=org.apache.nami
> ng.java.javaURLContextFactory
>
torque.dsfactory.global.jndi.java.naming.factory.url.pkgs=org.apache.nam
> ing
You don't want to set up your own initial context... you want to use the
one
supplied by Tomcat, because that's where your datasources are bound.
The
default config file may occasionally be confusing because there are
examples
for both looking up a DS from a JNDI context provided by the app server,
and
having Torque create its own JNDI Context and binding a datasource to
it,
rather than looking it up.
-- Bill
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
Re: Problem trying to use JNDI connection pool
Posted by Bill Schneider <bs...@vecna.com>.
Hi,
You might try deleting some of the unnecessary lines from
Torque.properties... One that works for me only has a handful of lines
## Using jndi
torque.dsfactory.global.factory=org.apache.torque.dsfactory.JndiDataSourceFa
ctory
torque.dsfactory.global.jndi.path=jdbc/global
Perhaps some of the lines in your config file are interfering with Tomcat's
JNDI context. In particular,
> torque.dsfactory.global.jndi.java.naming.factory.initial=org.apache.nami
> ng.java.javaURLContextFactory
> torque.dsfactory.global.jndi.java.naming.factory.url.pkgs=org.apache.nam
> ing
You don't want to set up your own initial context... you want to use the one
supplied by Tomcat, because that's where your datasources are bound. The
default config file may occasionally be confusing because there are examples
for both looking up a DS from a JNDI context provided by the app server, and
having Torque create its own JNDI Context and binding a datasource to it,
rather than looking it up.
-- Bill