Hurts while trying to have sex

Hey you guys so I haven’t had sex in about two years and me and the current person I’m talking to tried to have sex the other day but it kept hurting me when he had it in...is it because I haven’t had sex in a while? Also he never got it completely in so we didn’t finish so I was wondering if you guys could give me some tips for when we try next time.