The third mechanism provided by the JCo API for specifying parameters to the createClient() method is that of passing an external properties file. This technique enables you to completely remove the system parameters from your code and allows you maintain those values in an external configuration file.
The advantage to this technique is obvious, as all SAP system parameters are now centralized and can be maintained within a single properties file. Likewise, the properties file allows you to use all of the available parameters listing in the JCo API.
To use this version of the createClient() method you first create a plain text file (called "sap.properties" in this example):
In addition to the normal system parameters, I have also specified that RFC trace be enabled and set the idle timeout for this JCo connection to one millisecond. Notice that because the timeout value must be passed to JCo as an integer, it cannot be specified using double quotes. The name attribute must be that which is specified in the JCo API, i.e. "jco.client.lang" is the only name attribute that allows you to specify a language value.
In order to use this properties file, call the createClient() method like this:
Note that in order to load the properties, you must specify its full filesystem path name. Alternatively, if the properties file exists in the same directory as the Java class being executed, no path name is required. However, this is not recommended due to the varying nature of how your application may be deployed.
In addition, your application can override the default parameters set in the properties file by call the setProperty() method:
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.
All Rights Reserved, Copyright 2000 - 2008, TechTarget | Read our Privacy Policy SearchSAP.com is a search service provided by TechTarget and is completely independent of and not affiliated with SAP AG.