ODBC and Windows Service

c# odbc sqlbulkcopy windows-services

Question

I'm new to windows services and... you guessed it, I’m a bit stuck. Let me paint the picture –

I’m running a timed service that use an OdbcDataReader and SqlBulkCopy to (1) archive the data (2) normalize the data on a SQL box. When I run this code in a windows form proj. it works fine. Then, when I change the DNS’s Data Directory Path to a local drive, instead of the network share (just simulated the environment locally), it works as well.

I’m obviously missing something. Any help will be appreciated.

DNS

Popular Answer

When you run the windows form project it runs using your login account. The service runs using the LocalSystem account which probably does not have rights to access the network share specified in the ODBC settings.

You can check this by going into the Services Properties->Log On tab and make it run using your account. If it works then it probably was an access rights problem.

I would recommend creating a user account that just has enough access rights to access the share.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why