Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   I have to connect multiple hostnames dynamically by using JNDI (https://www.askmehelpdesk.com/showthread.php?t=774092)

  • Nov 5, 2013, 11:03 PM
    rajesh561
    I have to connect multiple hostnames dynamically by using JNDI
    Please help me,

    My problem is to connect multiple hostnames dynamically by using JNDI. I am using the JNDI,

    InitialContext ic = new InitialContext();
    Context envCtx = (Context) ic.lookup("java:comp/env");
    javax.sql.DataSource ds = (javax.sql.DataSource) envCtx
    .lookup("jdbc/MYDB");
    con = ds.getConnection();
    “jdbc/MYDB” is my JNDI name. It was configured in context.xml file in Tomcat.Like

    I have different host address like 1)abc.com 2)xyz.com…. Abc.com have the some users and xyz.com also have the some users when abc.com users login to my application then “url” must be replaced with abc.com and when xyz.com users login to my application then “url” must be replaced with xyz.com.

    Thanks in Advance……

  • All times are GMT -7. The time now is 12:38 AM.