Search code examples
java.netikvmjcosap-r3

Crazy idea: Connect .NET and SAP with SAP JCo using IKVM.NET


Because the SAP Connector for .NET is no longer maintained by SAP, I am now looking for an alternative to connect the Microsoft world with the SAP world. I know there are third party products like "ERPConnect", but I want to do this with tools from SAP (by the way I cannot use the Enterprise Services, because the target SAP system is SAP 4.6C).

Therefore there has arisen the crazy idea to use the SAP Java Connector in combination with the tool IKVM.NET (www.ikvm.net/devguide/net2java.html). IKVM.NET provides The IKVMC tool, which converts Java bytecode to .NET dll's and exe's. "No sooner said than done!" I converted the SAP JCo to .NET dlls and created a new Visual Studio solution.

I put all the JCo files into a subdirectory of my solution. I set 2 references to the generated IKVM.OpenJDK.Core.dll and sapjco.dll. Great, all JCo classes where now available as .NET classes. Full of optimism I wrote some little code to connect to a SAP system.

JCO.Client client = null; client = JCO.createClient(...)

The compilation of my test code had no errors. "Wonderful !" I thought. Then I started my test application. Unfortunately I got an exception calling JCO.createClient:

Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'\r\nno sapjcorfc in java.library.path

I have 2 questions on this topic.

  1. Do you think my idea using the SAP Java Connector (SAP JCo) to connect .NET with SAP is a good idea or is it nonsense? Perhaps someone had already the same idea ;-)

  2. How can the above exception be solved ?


Solution

  • 1) I don't think this approach is a good idea. The actual connection to sap is done not from java ( or from .net in the old .net connector). But from a c dll named, librfc32.dll. I believe that IKVM support of JNI is not complete.

    It will maybe work, But, even than, it will be fragile.