views:

228

answers:

2

I have a .Net service that has a list of strings containing ODBC connections and I use these in a loop to check multiple databases for tasks to process (eg. polling).

However if i change where an ODBC connection points to..by changing its default database for some reason, even though i'm only storing the string name of the ODBC connection it doesn't pick up the change until i restart the application.

Is .net somehow caching all the odbc connections on startup??

How can i work around this?

Cheers.

A: 

If your settings are stored in the app.config, here is a question that might help:

http://stackoverflow.com/questions/436700/is-switching-app-config-at-runtime-possible

Andy White
I have them stored in a local variable. eg. just the string like "Connection1" thats all it says when an ODBC connection has the same name. I then do new OdbcConnection("uid=Connection1,Uid=user,Pwd=pwd"); and thats it. "Connection1" never changes, only the ODBC connection itself does.
Schotime
A: 

Check if the Connection Pooling is enabled for the ODBC driver you are using at the ODBC Data Sources control panel window (this is not a .NET issue). A successful connection will stay in the pool without refreshing its new connection properties.

muratgu