Two burglars forced their way into a Rugby supermarket while night staff were still working, after spending more than an hour breaking into a neighbouring education centre.
They left when they were disturbed after forcing open the tills at the store in Dunchurch Road and taking more than £1,800 in cash.
But Warwick Crown Court heard that Robert Smith was arrested after his blood was found on the beading of a window they had removed to get in.
Smith, 26, of Langmead Court, Northampton, was jailed for 18 months after he had pleaded guilty to two charges of burglary.
Prosecutor John Brotherton said that one part of the Sainsbury’s premises in Dunchurch Road is let out to a children’s education facility called Explore Learning.
A CCTV camera captured Smith and an accomplice arriving at four in the morning on December 11, last year, and going to the side of the building.
They spent around 90 minutes removing the beading from a window before gaining entry at 5.30am.
The two intruders carried out a search and stole two tablet computers, a laptop and money from a cash tin.
They then forced their way through an internal door into the main store where they forced the till drawers with a hammer and a screwdriver, and stole cash floats totalling £1,880.
But although the store was closed, night staff were working elsewhere in the building – and they were disturbed by an employee who had heard a noise and found them hiding by the tills.
They fled and got away, but blood found on the beading they had removed was identified as Smith’s, and he was arrested in April.
When he was questioned he said he could not recall where he had been on the night of the burglary, but claimed he had not been to Rugby.
Smith, whose last conviction had also been for a burglary at a Sainsbury’s store, for which he had been given a suspended sentence, was then shown the DNA analysis of the blood.
After first suggesting he had been set up, he admitted he was ‘bang to rights,’ said Mr Brotherton.
Smith, who explained that he had been after money for Christmas, added that he was very sorry for what he had done, and wanted to sort his life out.
Richard Baker, defending, said: “On the previous occasion an offence like this was committed he had succumbed to drug addiction, but that’s not the case on this occasion.
“He was motivated by financial gain. He had a six-month-old child, he was having difficulty finding work, his girlfriend was on maternity leave, and they were struggling financially.”
But jailing Smith, Judge Griffith-Jones told him: “This is serious because at a time when staff were still working at night and you had taken precautions to cover your face, you made a determined effort to break in, which took you over an hour.
“You were after as much as you could get, it was a sustained burglary, and it wasn’t the first time you had done it.”