I designed a collaboration directive triggered by a web service using the SDK (ME 5.2.3).
Basically, this directive perform a select to get the material inventory, and then loop into the result to create one entry in a queue by material (those entries will be processed later)... So doing some insert in the database.
What I do, I open a DB connection, then loop to do my inserts...
Problem is that if this loop take too much time, the connection seems to be automatically closed, I got this in the log :
Connection object com.sap.sql.jdbc.vendor.VendorConnectionHandle@43c6ce53 has already been closed...
Do you know if there is a parameter we could extend (I guess the connection time-out is set to 60 seconds), or should I handle this in my code ?
Here is a summary of my code :
try {
connection = SystemBase.createDefaultSystemBase().getDBConnection();
for (int i = 0; i < inputInformation.size(); i++) {
row = inputInformation.extractRow(i);
....
statement.execute(insertQuery);
...
}
} catch (SQLException e) {
if (Utils.isTraceEnabled(Utils.COLLABORATION)) {
e.printStackTrace();
}
returnData.put("EXCEPTION", e.toString());
returnData.put("SUCCESS", "false");
returnData.put("ERROR_MESSAGE", e.getMessage());
return returnData;
} finally {
SystemBase.closeDBConnection(connection, statement);
}
Thanks