Search code examples
javajcosapjco3

reuse jco 3 connection pool for different sso tickets


We've created a java application that uses JCo3 to access the remote SAP system data.

We are using SSO Tickets connect to that system.

The question is if there is some way to reuse the same connection pool for all the user SSO Tickets instead of creating a dedicated pool for each token.

Currently we have a DestinationDataProvider.getDestinationProperties implementation that takes SSO Ticket as a parameter and returns the corresponding Properties instance, ending up, I believe, with a connection pool per user.

I'm not sure how efficient this configuration is and would probably like to know if those connections could somehow be reused.


Solution

  • The technical RFC connection design does not allow to reuse an RFC connection with a different user. An RFC connection is bound to a user identity which cannot be switched. Therefore a connection pool with multiple physical connections that will use different user ids on demand cannot be implemented. This is not a limitation of JCo but of RFC in general.

    However this is not so tragic as the most expensive part of RFC connection establishment is not the opening of a new physical connection via TCP/IP but the RFC user authorization process with its RFC context object creations and internal initializations. So having connection pools per destination and user is what really helps for achieving better performance. You do not need to worry and to take care for optimizing the internal JCo connection pooling. This already works fairly good out-of-the-box even with an own pool for each user ID.