What is the advantage to using JNDI over JDBC?  In my
Tomcat WAR app, I use 

<data-source
class-name="org.postgresql.jdbc3.Jdbc3PoolingDataSource">
<params server-name="*****" database-name="*****" 
initial-connections="2" max-connections="10"
user="*****" password="*****"/>
</data-source>

Why would I want to switch to JNDI?

Thanks.

Michael

--- Werner Guttmann <[EMAIL PROTECTED]> wrote:

> 
> Andreas,
> 
> please register the JDBC DataSource with Tomcat as
> explained in their docs by defining a <Resource>
> entry in server.xml (or elsewhere as there are 
> alternatives, depending on whether deploy a WAR file
> or not). The DataSource defined there will be bound
> to Tomcat's JNDI context at startup and will 
> be available to client programs under 'jdbc/MYDB'.
> 
> To make Castor use this JDBC DataSource (with
> pooling capabilities), please incl. the following
> fragment in your jdo-conf.xml (formerly known as 
> database.xml) file:
> 
> <database ... >
>    <jndi name="java:comp/env/jdbc/MYDB" />
> </database>
> 
> Also, don't forget to add a <resource-ref> entry to
> your web aplication in web.xml.
> 
> Regards
> Werner
> 
> On Wed, 15 Dec 2004 08:35:59 +0100, Andreas Vombach
> wrote:
> 
> >
> >To do this following the tomcat doc I need to
> specify
> >
> >    <Resource name="jdbc/MYDB" auth="Container"
> >      type="javax.sql.DataSource" 
> >driverClassName="oracle.jdbc.driver.OracleDriver"
> >      url="jdbc:oracle:thin:@dbip:1521:MYDB"
> >      username="user" password="pass"
> maxActive="20" maxIdle="10"
> >      maxWait="-1"/>
> >
> >in <tomcat-dir>/bin/server.xml
> >
> >How do I do the JNDI binding? Or do I have to
> follow the castor DBCP doc 
> >like
> >
> ><data-source
>
class-name="org.apache.commons.dbcp.BasicDataSource">
> >    <params
> driver-class-name="com.mysql.jdbc.Driver"
> >            username="test"
> >            password="test"
> >            url="jdbc:mysql://localhost/test"
> >            max-active="10" />
> >  </data-source>
> >
> >This would go into the database.xml file and
> appended by the mapping 
> >descriptor?
> >
> >Thanks for any help
> >Andreas
> >
> >
> >
>
>-----------------------------------------------------------
> 
> >If you wish to unsubscribe from this mailing, send
> mail to
> >[EMAIL PROTECTED] with a subject of:
> >        unsubscribe castor-user
> >
> 
> 
> 
>
-----------------------------------------------------------
> 
> If you wish to unsubscribe from this mailing, send
> mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user
> 



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to