driving device for a working machine, comprising an engine (106, 116), a plurality of variable displacement hydraulic pumps (2a-2f) which are driven by the engine (106, 116), hydraulic regulators (3a-3f) which vary and control delivery flow rates of the hydraulic pumps (2a-2f), respectively, a plurality of hydraulic actuators (7a-7c, 10c) which are driven by delivery pressures of the hydraulic pumps (2a-2f) and comprise at least a boom cylinder and an arm cylinder, connection devices that connect desired one of the hydraulic actuators (7a-7c, 10c) and at least one of the hydraulic pumps (2a-2f) through a closed circuit, control devices (40a, 40b) that generate control signals for the hydraulic actuators (7a-7c, 10c), detection devices which detect operation amounts of the control devices (40a, 40b), pressure sensors (30a-30h) that detect load pressures on the hydraulic actuators (7a-7c, 10c), and a controller that computes the delivery flow rate of the hydraulic pumps (2a-2f) to be fed to the hydraulic actuators (7a-7c, 10c) according to the detection devices and the pressure sensors (30a-30h) and controls the connection devices according to the control signal from at least one of the control devices (40a, 40b), wherein, one of the hydraulic actuators (7a-7c, 10c) is connected to at least one of the hydraulic pumps (2a-2f) through a closed circuit, and the controller comprises: a first target delivery-flow-rate setting unit that computes a first target flow rate of the at least one hydraulic pump (2a-2f) according to the operation amounts from the at least one control device (40a, 40b) and corresponding one of preset efficiency-setting values which are maximum efficiency for the hydraulic pumps (2a-2f); a hydraulic pump state amount computing unit that computes one of an efficiency of the at least one hydraulic pump (2a-2f) according to the load pressure of one of the pressure sensors (30a-30h) for the desired one hydraulic actuator and a delivery flow rate of the at least one hydraulic pump (2a-2f) based on the preset efficiency value for the at least one hydraulic pump (2a-2f); an output limiting unit that limits an output demand of the desired one hydraulic actuator (7a-7c, 10c) according to the first target flow rate calculated by the first target delivery-flow-rate setting unit, the load pressure detected by the one pressure sensor (30a-30h), the delivery flow rate computed by the hydraulic pump state amount computing unit, and a preset threshold level of output for the engine (106, 116); and a second target delivery-flow-rate setting unit that computes a second target delivery flow rate of the at least one hydraulic pump (2a-2f), which delivers the pressure oil to the desired one hydraulic actuator (7a-7c, 10c), according to a computed value from the output limiting unit and the delivery flow rate computed by the hydraulic pump state amount computing unit. a first target delivery-flow-rate setting unit that computes a first target flow rate of the at least one hydraulic pump (2a-2f) according to the operation amounts from the at least one control device (40a, 40b) and corresponding one of preset efficiency-setting values which are maximum efficiency for the hydraulic pumps (2a-2f); a hydraulic pump state amount computing unit that computes one of an efficiency of the at least one hydraulic pump (2a-2f) according to the load pressure of one of the pressure sensors (30a-30h) for the desired one hydraulic actuator and a delivery flow rate of the at least one hydraulic pump (2a-2f) based on the preset efficiency value for the at least one hydraulic pump (2a-2f); an output limiting unit that limits an output demand of the desired one hydraulic actuator (7a-7c, 10c) according to the first target flow rate calculated by the first target delivery-flow-rate setting unit, the load pressure detected by the one pressure sensor (30a-30h), the delivery flow rate computed by the hydraulic pump state amount computing unit, and a preset threshold level of output for the engine (106, 116); and a second target delivery-flow-rate setting unit that computes a second target delivery flow rate of the at least one hydraulic pump (2a-2f), which delivers the pressure oil to the desired one hydraulic actuator (7a-7c, 10c), according to a computed value from the output limiting unit and the delivery flow rate computed by the hydraulic pump state amount computing unit.