A driving cylinder of a pile driving rig comprising - a cylinder part with an outer cylinder liner and an inner cylinder liner fitted within each other, - a piston part comprising a piston rod extending from inside the inner cylinder liner outside it, wherein in the part inside the inner cylinder liner is a piston fitted tightly and reciprocatingly inside the inner cylinder liner, and in the part extending outside the inner cylinder liner is a fixture for fastening the piston rod to a ram block, - a piston-side head which is fastened tightly to the piston-side end of the outer cylinder liner and the inner cylinder liner in such a way that the pressure medium conveyed inside the driving cylinder will not be able to leak outside the driving cylinder through the joint between the piston-side head and the outer cylinder liner and inner cylinder liner, - a piston rod side head which is fastened tightly to the piston rod side end of the outer cylinder liner and the inner cylinder liner in such a way that the pressure medium conveyed inside the driving cylinder will not be able to leak outside the driving cylinder through the joint between the piston rod side head and the outer cylinder liner and inner cylinder liner, - at the piston-side head, at least one pressure medium outlet connection (30a-30d) for conveying the pressure medium outside the driving cylinder, and pressure medium ducts (31, 42, 43) for connecting the pressure medium outlet connection (30a-30d) and the interspace between the outer cylinder liner and the inner cylinder liner to the piston-side cylinder chamber limited by the piston-side head, the inner cylinder liner and the piston, - at the piston rod side head, at least one pressure medium inlet connection (26a-26d) for conveying the pressure medium from outside the driving cylinder into the driving cylinder, and pressure medium ducts for connecting the interspace between the outer cylinder liner and the inner cylinder liner to the piston rod side cylinder chamber limited by the piston rod side head, the inner cylinder liner and the piston, - fastening means for fastening the driving cylinder to the hammer of the pile driving rig, - and in which driving cylinder the solenoid valve controlling the operation is a slide valve which controls the pressure medium outlet ducts of the driving cylinder and is located at least partly at the piston-side head of the driving cylinder, and the stem of which slide valve is at least partly outside the inner cylinder liner in the direction of motion of the piston part. - a cylinder part with an outer cylinder liner and an inner cylinder liner fitted within each other, - a piston part comprising a piston rod extending from inside the inner cylinder liner outside it, wherein in the part inside the inner cylinder liner is a piston fitted tightly and reciprocatingly inside the inner cylinder liner, and in the part extending outside the inner cylinder liner is a fixture for fastening the piston rod to a ram block, - a piston-side head which is fastened tightly to the piston-side end of the outer cylinder liner and the inner cylinder liner in such a way that the pressure medium conveyed inside the driving cylinder will not be able to leak outside the driving cylinder through the joint between the piston-side head and the outer cylinder liner and inner cylinder liner, - a piston rod side head which is fastened tightly to the piston rod side end of the outer cylinder liner and the inner cylinder liner in such a way that the pressure medium conveyed inside the driving cylinder will not be able to leak outside the driving cylinder through the joint between the piston rod side head and the outer cylinder liner and inner cylinder liner, - at the piston-side head, at least one pressure medium outlet connection (30a-30d) for conveying the pressure medium outside the driving cylinder, and pressure medium ducts (31, 42, 43) for connecting the pressure medium outlet connection (30a-30d) and the interspace between the outer cylinder liner and the inner cylinder liner to the piston-side cylinder chamber limited by the piston-side head, the inner cylinder liner and the piston, - at the piston rod side head, at least one pressure medium inlet connection (26a-26d) for conveying the pressure medium from outside the driving cylinder into the driving cylinder, and pressure medium ducts for connecting the interspace between the outer cylinder liner and the inner cylinder liner to the piston rod side cylinder chamber limited by the piston rod side head, the inner cylinder liner and the piston, - fastening means for fastening the driving cylinder to the hammer of the pile driving rig, - and in which driving cylinder the solenoid valve controlling the operation is a slide valve which controls the pressure medium outlet ducts of the driving cylinder and is located at least partly at the piston-side head of the driving cylinder, and the stem of which slide valve is at least partly outside the inner cylinder liner in the direction of motion of the piston part.