An intoxicated O'Connor was apprehended by two witnesses at the scene and gardaí were called, the court heard.
Defence lawyer Annette Kealy said O'Connor had compensated the injured parties.
She said this incident took place during a period of upheaval in his life.
Ms Kealy said O'Connor was studying aeronautical engineering when he was involved in a motorbike accident, which left him hospitalised for a month. He was unable to continue studying, started drinking heavily and developed a drug problem.
On the day of this incident, Ms Kealy said O'Connor had received bad news about his relationship and was under the influence of alcohol.
This incident was the catalyst for O'Connor to realise he needed help and he has since undertaken a residential programme, she said.
O'Connor was now two years sober and working as an apprentice electrician.