We study utility maximization problem for general utility functions using dynamic programming
approach. We consider an incomplete nancial market model, where the dynamics of asset
prices are described by an Rd-valued continuous semimartingale. Under some regularity assumptions we
derive backward stochastic partial dierential equation (BSPDE) related directly to the primal problem
and show that the strategy is optimal if and only if the corresponding wealth process satises a certain
forward-SDE. As examples the cases of power, exponential and logarithmic utilities are considered.