Harsh Khandelwal
Harsh Khandelwal

Reputation: 1

SAP connection pooling

I am really new working with SAPJCO3 connections and I would like to know how can we use same connection pool for different properties. I.e different sysnr,host, password, client,user. Actually we get all these connection properties from an api that can change based on my spring boot api request. How do we take advantage of same sap connection pool.

I tried saving the destination objects to a global map and reusing them if properties are same as previous.but seems like a wrong way to me.

Upvotes: 0

Views: 142

Answers (1)

Trixx
Trixx

Reputation: 1885

Unlike, for example, a database connection, an SAP RFC connection is always bound to the target system, client and user ID. So, you cannot re-use such a connection with different users. A JCo3 connection pool is based on this limitation, which obviously has advantages and disadvantages. An advantage is of course, that time consuming logon authentication and authorization processes will be avoided as far as possible.

Don't worry about JCo3 connection pooling. It's managed automatically for you. Note that you use only JCoDestinations and you do not control individual connections themselves. That's a big difference. Just use multiple JCoDestination targets as needed without thinking about their internals. Trying to reduce the number of JCoDestination objects is useless. They are stored and fetched from a global map anyway.

If you really would like to gain some performance in this area, make sure that the registered DestinationDataProvider instance supports events.

Upvotes: 1

Related Questions