This paper concerns optimization of the Bolza problem with convex and nonconvex second order discrete and differential state variable inequality constraints. Necessary and sufficient conditions of optimality for second order discrete and differential inequalities are derived. According to proposed discretization method, the problem with discrete-approximation inequalities is investigated. Equivalence theorems for sub-differential inclusions are basic tools in the study of optimality conditions for continuous problems. This approach plays a much more important role in the derivation of second order adjoint discrete and differential inequality constraints generated by given inequality constraints. A numerical example is presented to illustrate the theoretical result.