Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

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

Kwok Peng Tuck

2003-06-03

Replies:

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@(protected):

>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@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.