cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to avoid storing password in the file in JCo 3.0 ?

Former Member
0 Kudos

I have luck getting an example work. So I have reply from SAP and I almost happy now 😉 but here are one thing making me sad :

  1. static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL"
  2. static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL"
  3. static 
  4. Properties connectProperties = new Properties(); 
  5. connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "SAPSERVERADDRESS"); 
  6. connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00"); 
  7. connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "230"); 
  8. connectProperties.setProperty(DestinationDataProvider.JCO_USER, "SAPUSER1"); 
  9. connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "SAPPASSAP;-)"); 
  10. connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en"); 
  11. createDestinationDataFile(DESTINATION_NAME1, connectProperties); 
  12. connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3"); 
  13. connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10"); 
  14. createDestinationDataFile(DESTINATION_NAME2, connectProperties); 
  15.  
  16.  
  17. static void createDestinationDataFile(String destinationName, Properties connectProperties) 
  18. File destCfg = new File(destinationName+".jcoDestination"); 
  19. try 
  20. FileOutputStream fos = new FileOutputStream(destCfg, false); 
  21. connectProperties.store(fos, "for tests only !"); 
  22. fos.close(); 
  23. catch (Exception e) 
  24. throw new RuntimeException("Unable to create the destination files", e); 
  25. /**
  26. * @param args the command line arguments
  27. */ 
  28. public static void main(String[] args) throws JCoException { 
  29. // TODO code application logic here 
  30.  
  31. JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME1); 

I do not like saving SAPLogin and password into any text file. Is there any way to avoid this?

Documentation says: "The first step defines destination names and properties.

NOTE

For this example the destination configuration is stored in a file that is called by the program. In practice you should avoid this for security reasons." How to code without storing properties into the file?

I am sorry I am not Java-programmer. I had some programming skill but it was on pre-OOP epoch.

So Java it's somekind of AbraKadabra for me.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

As long as you run your application on a NetWeaver AS Java in the end you can just skip the first 32 lines of code you have posted and define the Destination in the NWA (http://<server>:<port>/nwa/destinations).

The code you have posted should be just for local testing ONLY where you usually don't have installed a complete NW AS

Greethings

Ingo

Former Member
0 Kudos

Dmitry,

You can as well create a RFC destination and store a password in it. From your program you just need to call the existing destination. Check section Establishing an RFC Connection Using an Existing Destination in this link  http://help.sap.com/saphelp_nw73/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm

Cheers!!