import com.sap.mw.jco.*;
...
String[][] sapParams = { {"client", "000"}, {"user", "userid"}, {"passwd", "password"},
{"lang", "en"}, {"ashost", "mysaphost"}, {"sysnr", "00"} };
JCO.Client connection = JCO.createClient(sapParams);
...
connection.disconnect();
This is an effective method for passing dynamic values as system parameters to JCo and also allows you to use some of the more advanced user identification techniques (X509 certificates and SAP logon tickets). However, you are still faced with the challenge of maintaining hardcoded system parameters repeatedly throughout your application. A slightly better technique would be to specify these values as public final class variables then construct your String array with both those global values and any dynamic parameters you might require (see Part 1.)
GETTING CONNECTED WITH JCO
Home: Introduction
Part 1: Specifying parameters as single String values
Part 2: Specifying parameters using a String array
Part 3: Specifying parameters using an external properties file
Part 4: Specifying parameters with a custom properties file
Review: Conclusion and more resources
This was first published in July 2005