I have configured connection string in my IIS since I'm reusing it through my sharepoint solutions and custom services running next to sharepoint sites.
I'm using following snippet throughout my solutions, which works very well:
var connectionStrings = ConfigurationManager.ConnectionStrings;
connectionString = connectionStrings["FooDB"].ConnectionString;
But unfortunately that doesn't work for my custom sharepoint job, throwing exception Object reference not set to an instance of an object.. I suppose it is happening because job is executed by OWSTIMER process and not w3wp. How one can get around this issue?