Re: Windows service and oledb
- From: "William \(Bill\) Vaughn" <billvaNoSpam@xxxxxxxxx>
- Date: Fri, 23 Sep 2005 10:43:16 -0700
Make sure that you're trapping all exceptions and the target server is setup
to support mixed mode security--it defaults to SSPI only. I would avoid use
of OleDb when connecting to SQL Server. It's slower, and is COM-dependant.
SqlClient is THE interface to use. Just because you're using OleDb, you
won't be able to port your application over simply by changing provider
names. It's never that simple.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
www.sqlreportingservices.net
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Roel Oost" <roeloost@xxxxxxxxxxxxx> wrote in message
news:etShZ6CwFHA.3588@xxxxxxxxxxxxxxxxxxxxxxx
>I don't use windows authentication to connect to the server. The connection
> string is something like
> "Provider=SQLOLEDB;Data Source=servername;Initial
> Catalog=dbname;uid=username;pwd=password", so guess that should be no
> problem. Same code in a winform or webform app works fine, but only from a
> windows service the connection.open method behaves in described strange
> way
> (con.Open executes fine but results in a closed connection)
> Yes, I also wondered about using OleDb instead of SQLClient. It was an
> historical choice, using OleDb should be easier to use in the case the
> customer chooses another database to use. But that risk is almost nihil at
> the moment.
> I've evaluated the behavior of the SQLClient provider in this situation
> and
> guess what, it works fine....
> Still wondering about why OleDb doesn't in this case. I've configurated
> the
> winservice using the LocalSystem account, a local user account and a
> domain
> user account, to see if it has something to do with access to the database
> server machine (before connecting to the machine), but all same result...
> Hope to find an answer because for other connectiontypes we stille depends
> on OleDb.
>
> Roel
>
> "Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:CitzIRCwFHA.3020@xxxxxxxxxxxxxxxxxxxxxxxx
>> Hi Roel,
>>
>> Welcome to MSDN newsgroup.
>> Regarding on the problem you mentioend, based on my experience, it is
>> likely a security issue. for connecting to the SQLSERVER, what's your
>> connection string? I think you're using windows authentiation so that the
>> application will use the process's current running account to access the
>> Remote sqlserver. Generally, for deskop applications(winform or
>> console),
>> the application is running under the current logon user session. For
>> windows NT service, they're running under a non interactive logon
>> session(
>> local service, NetworkService or LOCAL SYSTEM) as you specified in the
>> Service control manager. And when accessing to a remote resource(on
> remote
>
>
.
- References:
- RE: Windows service and oledb
- From: Steven Cheng[MSFT]
- RE: Windows service and oledb
- Prev by Date: How do a get a sql serverSscale value from a numeric datatype
- Next by Date: Stored Procedure
- Previous by thread: RE: Windows service and oledb
- Next by thread: Re: Windows service and oledb
- Index(es):
Relevant Pages
|