You are on page 1of 1

DataBaseAccessor accessor = null;

try {
// 1. Read Import Parameter to get the channel ID for Lookup
Channel channel = container.getInputParameters().getChannel("jdbcChannel");
// 2. Get a database accessor for the channel.
accessor = LookupService.getDataBaseAccessor(channel);
// 3. Prepare a sql statement "sqlStatement".
String sqlStatement = "SELECT HTI_RTTYPE FROM HOSTTOWMS";
// 4. Execute lookup.
DataBaseResult dbresult = accessor.execute(sqlStatement);
// 5. Iterate over the result rows.
for (Iterator rows = dbresult.getRows(); rows.hasNext();) {
Map columnMap = (Map) rows.next();
result.addValue(columnMap.get("HTI_RTTYPE"));
}
// Steps 4. and 5. can be executed several times.
} catch (Exception e) {
// Exception Handling
} finally {
// 6. Close the accessor in order to free resources.
if (accessor != null)
accessor.close();
}

You might also like