hi all,

Why do we need the tag <resource-env-ref> in web.xml. What is the purpose of
this.
I saw some example where that was trying to register Datasource as JNDI
resource
in server.xml  and in web.xml. Why do we need at two places?

In server.xml:
  <Resource name="jdbc/myDB" auth="Container"
    type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/myDB">
    <parameter>
      <name>factory</name>
      <value>org.objectweb.jndi.DataSourceFactory</value>
    </parameter>
    <!-- configured by default for PostgreSQL, just change the values
         to set it for your database
    -->
    <parameter><name>username</name><value>mojo</value></parameter>
    <parameter><name>password</name><value>jojo</value></parameter>
    <parameter>
      <name>driverClassName</name>
      <value>org.postgresql.Driver</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:postgresql://localhost/javatest</value>
    </parameter>
  </ResourceParams>


In web.xml:
  <resource-env-ref>
    <description>
      DB Connection
    </description>
    <resource-env-ref-name>
      jdbc/myDB
    </resource-env-ref-name>
    <resource-env-ref-type>
      javax.sql.DataSource
    </resource-env-ref-type>
  </resource-env-ref>


I tried this, it was working fine. Then I removed the tag <resource-env-ref>
from web.xml and
It was working fine. Even I tested if there is any difference in loading on
startup or on first request.
There is no difference. In the two scenarios the resource was loaded when it
was requested for
the first time.  Can you please let me know why is it required to define
<resource-env-ref> in web.xml.

thanx
Venkat




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

Reply via email to