use of com.axway.ats.log.autodb.entities.Machine in project ats-framework by Axway.
the class DbReadAccess method getMachines.
public List<Machine> getMachines() throws DatabaseAccessException {
List<Machine> machines = new ArrayList<Machine>();
Connection connection = getConnection();
PreparedStatement statement = null;
ResultSet rs = null;
try {
statement = connection.prepareStatement("SELECT * FROM tMachines ORDER BY machineName");
rs = statement.executeQuery();
while (rs.next()) {
Machine machine = new Machine();
machine.machineId = rs.getInt("machineId");
machine.name = rs.getString("machineName");
machine.alias = rs.getString("machineAlias");
machines.add(machine);
}
} catch (Exception e) {
throw new DatabaseAccessException("Error retrieving machines", e);
} finally {
DbUtils.closeResultSet(rs);
DbUtils.close(connection, statement);
}
return machines;
}
Aggregations