You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gurumoorthy <g....@btinternet.com> on 2005/04/06 02:28:10 UTC

Host level JNDI Variable

Hi,
        The senario 

        I have 4 VIRTUAL HOST on tomcat dev / sit / uat / prod 
        Based on host information i need to access different database instance
        jdbc:..../DEV : for dev
        jdbc:..../SIT : for sit
        and so on...
Can anyone let me know how to set the JNDI variable at host level or service level ?

Many thanks
Guru 

Re: Host level JNDI Variable

Posted by Gurumoorthy <g....@btinternet.com>.
Hello,
            Many thanks for your reply ... I have set the Global database
JNDI, No problem about this.

            The way we deploy the code is just drop the .war files in the
webapps directory. ( The administrator does not allow us to change the
server.xml file )

            So what I suggested is that I declare a JNDI variable for each
the virtual host ( one time change to server.xml )

            So that when I add new .war files to the webapps directory  the
war files will get the common JNDI name for that virtual host and hence
            corresponding database connection.

            Hope that i am clear
Regards
Guru



----- Original Message -----
From: "Parsons Technical Services" <pa...@earthlink.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, April 06, 2005 4:06 AM
Subject: Re: Host level JNDI Variable


> To use pooling provided by Tomcat, one way to do it is to set up four
> Globalresources in the server.xml
>
> Then from your apps call the one you want. You will need the resource link
> in the context for each app for the matching Globalresource.
>
> So set up four globals: dataDev, dataSit, dataUat and dataProd
> Place links in the context for apps in the DEV to dataDev
> for apps in SIT to dataSit and so on.
>
> Since the connections are established to the database and not the engine,
> each pool is dedicated to that database. So in effect you will be creating
a
> pool for each database and then connecting to the appropriate pool. And in
> order to create the pool the database must be specified, so it cannot be
> selected at any point later in the process.
>
> Doug
>
>
> ----- Original Message -----
> From: "Gurumoorthy" <g....@btinternet.com>
> To: "tomcat-user@jakarta.apa" <to...@jakarta.apache.org>
> Sent: Tuesday, April 05, 2005 8:28 PM
> Subject: Host level JNDI Variable
>
>
> Hi,
>         The senario
>
>         I have 4 VIRTUAL HOST on tomcat dev / sit / uat / prod
>         Based on host information i need to access different database
> instance
>         jdbc:..../DEV : for dev
>         jdbc:..../SIT : for sit
>         and so on...
> Can anyone let me know how to set the JNDI variable at host level or
service
> level ?
>
> Many thanks
> Guru
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


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


Re: Host level JNDI Variable

Posted by Parsons Technical Services <pa...@earthlink.net>.
To use pooling provided by Tomcat, one way to do it is to set up four 
Globalresources in the server.xml

Then from your apps call the one you want. You will need the resource link 
in the context for each app for the matching Globalresource.

So set up four globals: dataDev, dataSit, dataUat and dataProd
Place links in the context for apps in the DEV to dataDev
for apps in SIT to dataSit and so on.

Since the connections are established to the database and not the engine, 
each pool is dedicated to that database. So in effect you will be creating a 
pool for each database and then connecting to the appropriate pool. And in 
order to create the pool the database must be specified, so it cannot be 
selected at any point later in the process.

Doug


----- Original Message ----- 
From: "Gurumoorthy" <g....@btinternet.com>
To: "tomcat-user@jakarta.apa" <to...@jakarta.apache.org>
Sent: Tuesday, April 05, 2005 8:28 PM
Subject: Host level JNDI Variable


Hi,
        The senario

        I have 4 VIRTUAL HOST on tomcat dev / sit / uat / prod
        Based on host information i need to access different database 
instance
        jdbc:..../DEV : for dev
        jdbc:..../SIT : for sit
        and so on...
Can anyone let me know how to set the JNDI variable at host level or service 
level ?

Many thanks
Guru 



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