Call Data Source [Websphere] From Java Application
It's 2 Way to Call
1. Use Library From Websphere [Use Rad to Call]
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere .naming.WsnInitialContextFactory"); // Context Name For Call
env.put(Context.PROVIDER_URL, "iiop://localhost:2809/");// IP Address of JNDI Name which you can look at Servers --> Application Server and then Server that use JDBC --> Port (Communications) --> BOOTSTRAP_ADDRESS
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("jdbc/test");//JNDI Name
2. Use Context Sun [But I tested, It still return NULL.]
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi .cosnaming.CNCtxFactory"); // Sun Context
env.put(Context.PROVIDER_URL, "iiop://localhost:2809/");// IP Address of JNDI Name which you can look at Servers --> Application Server and then Server that use JDBC --> Port (Communications) --> BOOTSTRAP_ADDRESS
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("cell/nodes/Node01/servers/server1/jdbc/test"); //JNDI Name [You call Real Path] --> cell/nodes/< node Name > /servers/< server Name >