This is an old problem with a new twist. I am trying to do a jndi lookup on an entity bean that is using an Oracle data source.
Since WebSphere server cannot locate an Oracle database by default, I assume I need to pass the WAS Context the url and maybe a context factory name of some sort.
I don't have the values set correctly, and I cannot find any WAS-Oracle examples using a Hashtable to pass environment variables.
Would you take a look at my two put statements for my Hashtable (env)?
package sessions;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.*;
import entities.ora9EmpLocal;
import entities.ora9EmpLocalHome;
/**
* Bean implementation class for Enterprise Bean: Session1
*/
public class Session1Bean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
/**
* getSessionContext
*/
static final
String jndiName = "ejb/entities/ora9EmpLocalHome";
public void runOra9Emp(int empno){
ora9EmpLocalHome oh;
ora9EmpLocal ol;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.jdbc.driver.OracleDriver");
env.put(Context.PROVIDER_URL, "jdbc

racle:thin:@AVALON:1521:JINXSID");
try {
InitialContext initialContext = new InitialContext(env);
Object homeObject = initialContext.lookup(jndiName);
oh = (ora9EmpLocalHome) homeObject;
} catch (NamingException e) {
e.printStackTrace();
}
}
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
/**
* ejbCreate
*/
public void ejbCreate() throws javax.ejb.CreateException {
}
/**
* ejbActivate
*/
public void ejbActivate() {
}
/**
* ejbPassivate
*/
public void ejbPassivate() {
}
/**
* ejbRemove
*/
public void ejbRemove() {
}
}