Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: 22 Jul 2005 08:53:47 -0700,    group: microsoft.public.dotnet.myservices        back       


ODBC Error in windows service   
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.
date: 22 Jul 2005 08:53:47 -0700   author:   glose

Re: ODBC Error in windows service   
Under what logon usernames is the DSN valid?
Under what logon username does the service run?

- Lee

glose wrote:
> 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.
>
date: Fri, 22 Jul 2005 13:23:51 -0700   author:   Lee Gillie

Re: ODBC Error in windows service   
The DSN is setup as a System DSN and the service is installed as
ServiceAccount.LocalSystem.
date: 22 Jul 2005 13:35:45 -0700   author:   glose

Re: ODBC Error in windows service   
glose wrote:
> The DSN is setup as a System DSN and the service is installed as
> ServiceAccount.LocalSystem.

LocalSystem account can not access network resources. Is your database 
local?  I typically use a domain user for database work.
date: Fri, 22 Jul 2005 14:50:13 -0700   author:   Lee Gillie

Re: ODBC Error in windows service   
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.
date: 22 Jul 2005 16:32:11 -0700   author:   glose

Re: ODBC Error in windows service   
glose wrote:
> 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.
> 

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 
work may be a good source also since ASP runs as a service as well.
date: Mon, 25 Jul 2005 13:29:53 -0700   author:   Lee Gillie

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us