cancel
Showing results for 
Search instead for 
Did you mean: 

Can I Create My JCoDestination File In Folder ? (JCo3 Java - SAP RFC Connection)

I want to access an RFC function on sap from my java program.

When I call getDestination("connect") I can connect and run my function without problems.

But I will have more than one config file because I will be connecting to different SAP servers.

I want to collect all of these files in one folder, but when I write getDestination("src/JcoDestinations/connect") it does not read my config file that I put in the folder and does not connect.

How do I get all my connect jcoDestination config files together and run?

The error I get is this :

(106) JCO_ERROR_RESOURCE: Destination 'connect' does not exist. –

I tried:

<code>File file = new File("src/JcoDestinations/connect");
JCoDestination destination = JCoDestinationManager.getDestination(file.toString());

and:

<code>File file = new File("C:\\connect");
JCoDestination destination = JCoDestinationManager.getDestination(file.toString());

these did not work for me.

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions.

As you're looking to get most out of your community membership, please consider include a profile picture to increase user engagement & additional resources to your reference that can really benefit you:

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,

Alex

Accepted Solutions (1)

Accepted Solutions (1)

HAL9000
Product and Topic Expert
Product and Topic Expert

Hi Yiğit,

in addition to Markus reply I would like to stress that using the default implementation of the DestinationDataProvider (which reads from files <DestName>.jcoDestination) is not recommended for productive scenarios.
This is what the JCo JavaDoc says:

For security reasons, the default implementation of the DestinationDataProvider should not be used in productive environments. This default implementation stores sensitive user logon credentials as unsecured plain text in property files (<DESTINATION_NAME>.jcoDestination) in the current working directory. Although at least passwords are getting obfuscated automatically on their first usage, this is still no real encryption or secure storage for user credential data. Everyone having read access to these property files would be able to use the therein contained user credentials for logging on to the respective SAP back-end system under this user identity with also obtaining all authorizations of this user.
The default DestinationDataProvider implementation is only offered for quick development purposes and prototyping. It might also be tolerable for being used in test scenarios with SAP back-end systems which do not contain any critical or confidential data. However, in productive scenarios one should always register and use a custom DestinationDataProvider infrastructure component, which is capable of storing sensitive user credential data in a secure storage.

Best regards,
Stefan

0 Kudos

Hi Stefan,

I understand, thank you so much.

Best regarts,
Yiğit.

Answers (2)

Answers (2)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert

Hello Yiğit,

the defaullt implementation for the DestinationDataProvider uses the process work directory as a location for all destinations (file extension needs to be jcoDestination, the file name the name of the destination). Assume you have the files MyDest1.jcoDestination and MyDest2.jcoDestination, then you can access them using

JCoDestination destination = JCoDestinationManager.getDestination("MyDest1");

and

JCoDestination destination = JCoDestinationManager.getDestination("MyDest2");

No need to provide a path for the destination, only the destination name needs to be used
Best regards,
Markus

0 Kudos

Hello Markus, thanks for replying.

I know i can use different target files as you wrote, but these files need to be in the working directory.

I want to collect all these jco files in a folder and use these files from within this folder.

But i cant do it, because getDestination method is not allow writing path, it's only allows file name.

Thank you.

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Yiğit,

you do not provide a file name, you provide a destination name and the implementation of the DefaultDestinationDataProvider simply uses the work directory to search for files following the naming scheme it expects. If you need some different behavior, you should implement your own DestinationDataProvider, which is anyway strongly recommended for productive environments as outlined by Stefan in his answer.

Best regards
Markus

zfiori
Participant
0 Kudos

" The default DestinationDataProvider implementation is only offered for quick development purposes and prototyping. It might also be tolerable for being used in test scenarios with SAP back-end systems which do not contain any critical or confidential data. However, in productive scenarios one should always register and use a custom DestinationDataProvider infrastructure component, which is capable of storing sensitive user credential data in a secure storage. "

🙂