I have implemented a standalone JCo-Client which has to make multiple calls to the same BAPI.
Java 1.5
SAP JCo 3.01
Windows Server 2003
Now I have the problem that each BAPI-Call opens a new network connection (checked with netstat). I use a pooled connection, I have only one JCoDestination object and one JCoFunction object on which I do many function.execute(destination).
Under JCO 2 i used a ClientPool and didn't have the increasing number of network connections.
Any ideas how to solve this.
I add the rump coding so you get the idea:
String destinationName = "ConnPool";
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "XXX");
...
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "5");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "5");
createDestinationDataFile(destinationName, connectProperties);
int count = 0;
try {
JCoDestination destination = JCoDestinationManager.getDestination(destinationName);
JCoFunction function = destination.getRepository().getFunction("BAPI_NAME");
if (function == null)
throw new RuntimeException("BAPI not found in SAP.");
do {
count++;
try {
JCoStructure importStruktur = function.getImportParameterList().getStructure("IMPORT");
...
function.execute(destination);
JCoStructure exportStruktur = function.getExportParameterList().getStructure("EXPORT");
...
}
catch (AbapException e) {
System.out.println(e.toString());
}
} while (count < 50000);
}
catch(JCoException ex) {
System.out.println(ex.toString());
}
Edited by: Jochen Lang on Apr 29, 2009 1:30 PM