You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by me...@assetmanagement.natexis.fr on 2003/06/03 13:32:12 UTC

DataSource configuration in web.xml instead of server.xml

hi all,

I 've configured my DataSource configuration within a DefaultContext in
the server.xml file in tomcat(4.1). Everything works fine.


Now I would like to move this configuration in the web.xml file. The 
datasource section
in the documentation explains that is's possible.

I use DBCP api.

here is an extract of my server.xml datasource configuration.

<DefaultContext>
 
            <Resource name="jdbc/raise" auth="Container"
                    type="javax.sql.DataSource"/>  
 
          <ResourceParams name="jdbc/raise">
 <parameter><name>username</name><value>raisepartner</value></parameter>
 <parameter><name>password</name><value>pwd4rpd</value></parameter>
            <parameter><name>driverClassName</name>
              <value>com.sybase.jdbc2.jdbc.SybDriver</value></parameter>
            <parameter><name>url</name>
 <value>jdbc:sybase:Tds:s198000WEBD:4100/raise_partner</value></parameter> 
 
          </ResourceParams>
 
 </DefaultContext> 

I guess, I must put those line below in the web.xml file



<web-app>
 
  <resource-ref> 
     <res-ref-name>jdbc/raise</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

how must I specify the other parameters(username,password ...).

any help would appreciated.

Meissa






L'integrite de ce message n'etant pas assuree sur internet, Natexis
Banques Populaires ne peut etre tenu responsable de
son contenu. Toute utilisation ou diffusion non autorisee est
interdite. Si vous n'etes pas destinataire de ce message, merci de le
detruire et d'avertir l'expediteur.

The integrity of this message cannot be guaranteed
on the Internet. Natexis Banques Populaires can not therefore be
considered responsible for the contents.Any unauthorized use or dissemination is prohibited.
If you are not the intended recipient of this message, then please delete it and 
notify the sender.

Re: DataSource configuration in web.xml instead of server.xml

Posted by Kwok Peng Tuck <pe...@makmal.net>.
You can have a context for your application defined in a seperate xml 
file but not in the web.xml. If you read the dtd for the web.xml you'll 
see that this is not allowed.
Simply copy your context that works and paste into a new xml file, which 
has the same name as your webapp.
So if you had your app as test.war, then create test.xml. Put these two 
in the webapps directory, it should autodeploy properly without much 
hassle.  It should work. If it doesn't then restart tomcat.

meissa.Sakho@assetmanagement.natexis.fr wrote:

>hi all,
>
>I 've configured my DataSource configuration within a DefaultContext in
>the server.xml file in tomcat(4.1). Everything works fine.
>
>
>Now I would like to move this configuration in the web.xml file. The 
>datasource section
>in the documentation explains that is's possible.
>
>I use DBCP api.
>
>here is an extract of my server.xml datasource configuration.
>
><DefaultContext>
> 
>            <Resource name="jdbc/raise" auth="Container"
>                    type="javax.sql.DataSource"/>  
> 
>          <ResourceParams name="jdbc/raise">
> <parameter><name>username</name><value>raisepartner</value></parameter>
> <parameter><name>password</name><value>pwd4rpd</value></parameter>
>            <parameter><name>driverClassName</name>
>              <value>com.sybase.jdbc2.jdbc.SybDriver</value></parameter>
>            <parameter><name>url</name>
> <value>jdbc:sybase:Tds:s198000WEBD:4100/raise_partner</value></parameter> 
> 
>          </ResourceParams>
> 
> </DefaultContext> 
>
>I guess, I must put those line below in the web.xml file
>
>
>
><web-app>
> 
>  <resource-ref> 
>     <res-ref-name>jdbc/raise</res-ref-name>
>     <res-type>javax.sql.DataSource</res-type>
>      <res-auth>Container</res-auth>
>  </resource-ref>
>
>how must I specify the other parameters(username,password ...).
>
>any help would appreciated.
>
>Meissa
>
>
>
>
>
>
>L'integrite de ce message n'etant pas assuree sur internet, Natexis
>Banques Populaires ne peut etre tenu responsable de
>son contenu. Toute utilisation ou diffusion non autorisee est
>interdite. Si vous n'etes pas destinataire de ce message, merci de le
>detruire et d'avertir l'expediteur.
>
>The integrity of this message cannot be guaranteed
>on the Internet. Natexis Banques Populaires can not therefore be
>considered responsible for the contents.Any unauthorized use or dissemination is prohibited.
>If you are not the intended recipient of this message, then please delete it and 
>notify the sender.
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org