Data Source en OAS 10.1.3.1
mayo 06, 2008 by Isaac Ruiz Guerra
Me encuentro haciendo algunas cosas en el OAS 10.1.3.1. - ahora entiendo la razón de la compra de BEA XD -
Y he requerido acceder a un dataSource, aquí les dejo el código por si le sirve a a alguien.
try {
InitialContext initContext = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
ht.put(Context.PROVIDER_URL, "http:ormi://localhost:8888");
ht.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
ht.put(Context.SECURITY_CREDENTIALS, "mypassword");
initContext = new InitialContext(ht);
System.out.println("Name in space"+ initContext.getNameInNamespace());
javax.sql.DataSource dataSource = (javax.sql.DataSource) initContext.lookup("jndi/MySQLDS");
System.out.println("Data Source cargado sin problemas");
} catch (NamingException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Asegúrense de tener en el classpath el jar: oc4jclient.jar ubicado en: <OAS>oc4j/j2ee/home/
Saludos...
RuGI
Isaac Ruiz Guerra.