How to buy shares in india using demat account

Is it mandatory to have a Demat account to buy shares in India?,