The invention relates to a method for drilling rock, wherein holes to be drilled are determined prior to drilling as a drilling pattern wherein for each hole, a starting place, direction and hole depth for drilling are determined with respect to the rock to be drilled. In the invention, hole-type-specific drilling parameters are determined for the holes to be drilled, and during a drilling phase a drill rig automatically selects drilling parameters for each hole to be drilled on the basis of the hole type of the particular hole.