cancel
Showing results for 
Search instead for 
Did you mean: 

[JCo] Dynamic User-Logon

Former Member
0 Kudos

Hello,

I'm developing a stand-alone Java-Application that calls RFC-programs within a SAP-system.

To test my connection I did it as written in the JCo-documentation:


Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "sample.com");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "100");
connectProperties.setProperty(DestinationDataProvider.JCO_USER,"USER_ID");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,"password");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "de");
createDestinationDataFile(DESTINATION_NAME1, connectProperties);
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,"10");
createDestinationDataFile(DESTINATION_NAME1, connectProperties);

It works, but I'd like to use the user-id and -password that is used to login to my Java application.

Thanks in advance.

Regards, Ruben

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Problem solved!!!!

After nearly two days of searching I found a great Tutorial. Justclick http://www.vogella.de/articles/SAPJCo/article.html

Former Member
0 Kudos

The packaged example program CustomDestinationDataProvider.java also gives a short example on how to use an own DestinationDataProvider instance.

Just two further remarks on this:

1. Don't implement the DestinationDataProvider as shown at your posted web site. You should be able to react on different destination names or at least check the destination name instead of always returning the same (static) object.

2. I recommend to use the JCoCustomDestination for adding user credentials at runtime. The DestinationDataProvider is a global instance. Otherwise your user credentials can be used by other applications in a multi-application environment. Of course, this doesn't matter with a stand-alone program.