Potassium sorbate is added to sugary drinks to extend their shelf life. It works by stopping yeasts from reproducing. In your case, refined white sugar water that is boiled first should last a bit longer. You’d still need to change it frequently.
I second this.
Every time I make a sugar water mix (1:3 parts sugar to water), I boil the water, then quickly add the sugar. I've had sugar water last up to 2 weeks without the apperaence of any visible fungus/bacteria colonies or microbes simply by boiling the water to heat up the sugar and kill most microbes. Not only is boiling the water beforehand effective at killing microbes, it also dissolves granulated sugar faster as well.
You can also use honey as a substitute for the sugar to make honey water, which is usually much preffered to normal honey by most species.
Leave the Road, take the Trails - Pythagoras
Utah Ant Keeping --- Here
DIY Formicariums and Outworlds --- Here
Honeypot Ant Journal --- Here
Photo Album --- Here
Videos --- Here