Groups | Blog | Home
all groups > dotnet myservices > july 2005 >

dotnet myservices : ODBC Error in windows service


glose
7/22/2005 8:53:47 AM
Hello All -

I'm attempting to move an exe over to a windows service. I can bot seem
to get ODBC to create a connection.

The following code -

string connectionString = "DSN=SW Users";
OdbcConnection newConnection = new OdbcConnection(connectionString);
newConnection.Open();

throws the following error -

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
SQLSetConnectAttr failed

n

at System.Data.Odbc.OdbcConnection.Open()



This exact same code works fine from an exe though.

Any info would be appreciated.
Lee Gillie
7/22/2005 1:23:51 PM
Under what logon usernames is the DSN valid?
Under what logon username does the service run?

- Lee

[quoted text, click to view]
glose
7/22/2005 1:35:45 PM
The DSN is setup as a System DSN and the service is installed as
ServiceAccount.LocalSystem.
Lee Gillie
7/22/2005 2:50:13 PM
[quoted text, click to view]

LocalSystem account can not access network resources. Is your database
glose
7/22/2005 4:32:11 PM
There appears to be four choices in the ServiceAccount (Local,System,
Network, User) and I've tried all four with no luck.

In my test case the DB is local but this won't be the case in
production.
Lee Gillie
7/25/2005 1:29:53 PM
[quoted text, click to view]

It has been a very long time since I've done anything with ODBC, but I
am beginning to point to the idea that it may be an ODBC specific sort
of issue. It is my recollection that for this I would turn on a tracing
feature (can't remember where this ways - control panel???) and checked
the logs to get the driver specific reason. Maybe if this doesn't help
try one of the other groups more specific to ODBC. People who do web
AddThis Social Bookmark Button