Skip to Content
Author's profile photo Former Member

Calling Oracle from SAP on EJB level

The goal of our project was to link an Oracle database with an ABAP datasource. For some reasons, the Oracle developers had already written an EJB that would make the data accessible by means of RMI. That is why it had been decided that we do an architecture having a SAP J2EE stack in between. ABAP <-> SAP J2EE Engine <-> Oracle Application server The J2EE application would register itself as an RFC target in the ABAP stack and would then call the respective RMI functions. Oracle provides some classes com.evermind.* to connect to their application server. This would look somehow like this: Hashtable env = new Hashtable(); env.put(“java.naming.provider.url”,”provider_url”); env.put(“java.naming.factory.initial”, “com.evermind.server.ApplicationClientInitialContextFactory”); env.put(Context.SECURITY_PRINCIPAL,”login”); env.put(Context.SECURITY_CREDENTIALS,”password”); ctx = new javax.naming.InitialContext(env); From that statement on, it should be possible to call functions over that context. The rest should be pretty straight forward. But there is one pitfall. As we have discovered, the standard Oracle driver will set some Java system parameters. These system parameters interfere (at least with our version: Netweaver 04) with the SAP J2EE stack. Please make sure to add these lines of code when closing the connection to the Oracle backend: Properties my = System.getProperties(); my.remove(“java.naming.factory.object”); my.remove(“java.naming.factory.state”); my.remove(“java.naming.factory.control”); my.remove(“java.naming.factory.initial”); my.remove(“java.naming.provider.url”); System.setProperties(my); That will keep you from playing around with losing the RFC connections in ABAP all the time (otherwise the gateway would just allow one single call, not allowing any more connections). Happy integrating 🙂

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.