Sol-gel coatings for optical chemical sensors and biosensors