javapropertiesconnectionjco

Building JCoServer without Properties-File


With JCo you can easily build up a connection like it is explained in the example sheets which came with the JCo library. Unfortunately, the only way building a connection is handled with a created property file. It wouldn´t be that bad, if there wasn´t any sensible data in it. But at least, the password for the SAP user stands in the file, so it is a lack of safety in this way of connection-handling. The manual of JCo says so, too :

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.

but couldn´t find a working solution after all. There are a palmful threads about this theme, like this

http://forums.sdn.sap.com/thread.jspa?messageID=7303957

but none of them are helpful. I really can´t figure out a solution and neither find one. Actually I solved the security-problem with deleting the file after building the connection, but this is not a satisfying solution. There is to be a better way getting the parameter for the connection, especially when it stands in the manual, but I have no clue how.

Did anybody already work with JCo 3.0 and know this problem?


Solution

  • Yes, that's possible. You have to create your own implementation of DestinationDataProvider and register it using Environment.registerDestinationDataProvider(). However your DDP obtains the connection data and credentials is up to you. Take a look at net.sf.rcer.conn.connections.ConnectionManager, there's a working example in there.

    You need to