Of course.

First, I configured a DataSource in tomcat's GlobalNamingResources, and
put a ResourceLink inside my context so it could "see" my datasource
when needed. The configurations seems like the following in tomcat's
server.xml:

(GlobalNamingResources)

<Resource name="jdbc/global" type="javax.sql.DataSource"
auth="Container"/>
<ResourceParams name="jdbc/global">
        <parameter>
                <name>factory</name>
        
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
                <name>driverClassName</name>
                <value>org.postgresql.Driver</value>
        </parameter>
        <parameter>
                <name>url</name>
                <value>jdbc:postgresql://localhost/global</value>
        </parameter>
        <parameter>
                <name>validationQuery</name>
                <value>select 1</value>
        </parameter>
        <parameter>
                <name>username</name>
                <value>global</value>
        </parameter>
        <parameter>
                <name>password</name>
                <value>pass</value>
        </parameter>
</ResourceParams>

(My context)

<Context docBase="S:\WebAppTests" path="/tests" reloadable="true">
        <ResourceLink name="jdbc/global" global="jdbc/global"
type="javax.sql.DataSource"/>
</Context>

It should got a JNDIDataSource to work. If you don't need a global
datasource, you will need to put the datasource configurations inside
your context and make a few more configurations in your application's
web.xml (niclude a resource-ver to your resource).

After this, in torque.properties file, I removed the comments from only
two lines related with JNDI and put my configurations, as the following:

torque.dsfactory.global.factory=org.apache.torque.dsfactory.JndiDataSour
ceFactory
torque.dsfactory.global.jndi.path=java:comp/env/jdbc/global

The other lines related with old connection pool and jdbc2 pool where
commented out.

I hope it helps. Fell free to ask more. Surely I'll help if I can.

iran

-----Mensagem original-----
De: Dan Tran [mailto:[EMAIL PROTECTED]] 
Enviada em: quinta-feira, 26 de dezembro de 2002 19:34
Para: Turbine Torque Users List
Assunto: Re: Sharing information


Could you share on how you got JNDI working?

Thanks
----- Original Message -----
From: "Iran Marcius" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 26, 2002 2:11 AM
Subject: Sharing information


> A few days ago I was unsuccessfully trying get torque to work with
JNDI
> DataSource. Studying the problem more deeply, I figured out my JNDI
> stuff wasn't working at all (even without torque).
>
> After a lot of pain and crying I found out what was happening. I had
> tomcat-naming.jar in WEB-INF/lib and it was messing up my JNDI stuff.
> After I removed it, everything worked fine.
>
> So, thanks to everyone who tried to help me.
>
> iran
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to