Reputation: 387
I have C# windows service that polls an ADS 9.10 advantage database periodically during the day using Quartz.net. The window's service is still in development and hasn't be put live. On the test box the database is refreshed nightly. Whilst the database is being restore the windows service correctly logs error. Once the restore has finished the windows service continues running correcly for a few attempt but then this error occurs.
Error: Advantage.Data.Provider.AdsException: Error 6097: Bad IP address or port specified in the connection path or in the ADS.INI file. axServerConnect at Advantage.Data.Provider.AdsInternalConnection.Connect() at Advantage.Data.Provider.AdsPoolManager.GetConnection(String strConnectionString, AdsInternalConnection& internalConnection, AdsConnectionPool& pool) at Advantage.Data.Provider.AdsConnection.Open()
The only way to resolve this is to stop and start the service. To me this means something must be caching a bad connection, Which I don't understand as I'm do the C# USING wrapper around the connection and command, thus disposing the connection after it finished. I've tried turning off the connection pooling in the connection string
AdsConnection.FlushConnectionPool(_connectionString)
AdsConnection.FlushConnectionPool()
Please note that I don't use the ADS.ini file, the IP address and port number are in the connection string.
One solution could be use a schedule task rather than the quartz job... but I like quartz so I would like to fix this problem.
Upvotes: 0
Views: 1874
Reputation: 3373
The requirement to restart the service to resolve problem is probably due to caching of connection error codes by the ADS clients. I think the only solution to get around the error code caching is to use the RETRY_ADS_CONNECTS configuration in the ads.ini. The ads.ini file can be placed in the same directory as the service.
The 6097 error is returned when the database is down while being refreshed and then cached by the ADS ado client.
Upvotes: 2