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……