I am facing a problem with xp_read_file(), which is returning NULL in case i am trying to access a network drive path.
e.g. dbo.xp_read_file('C:db.log') works fine and return the data in binary.
but if i just try to read the file from any network path or mapped drive like dbo.xp_read_file('Z:db.log') it return NULL.
The same behavior is happening with xp_write_file() and xp_cmdshell().
Note: If i am running the database manually this is working fine i.e. without creating service, but if i create a SERVICE for the database it stop working and return null.
This is something a very strange behavior not sure if it is a problem with the permissions (i have an administrator rights on Domain) or some settings to be done at database level.
Request if anyone from you have faced the same problem can please share your thought.
This question is marked "community wiki".
asked 11 Apr '11, 11:28
Services typically do not have access to network drives on Windows. You need to run the service as another user - one that has the appropriate permissions - if you want your service to access the network.
answered 11 Apr '11, 11:50
Even while running the Service with the account who has all the permissions (Administrator), i am facing the same problem. It's returning NULL
Even no result with DOMAIN User.
Is there any specific way to configure it. I am simply "Log On" Tab for the service under Windows services...
Accessing SMB/CIFS/NetBIOS shares as the standard SERVICE account in Windows with the standard security policy doesn't work. When you log in to a Windows box and map a network drive, the mapping only exists in the logged-in user's context. You didn't log in as SERVICE, so the SERVICE user doesn't see the share you mapped. This is correct from a security perspective. If Jane and John, for example, both log in to the same Windows box at the same time, and Jane maps a network drive, John shouldn't have access to that drive (John himself needs to authenticate himself to the SMB server).
I would suggest the following alternatives:
Alternative 2 allows you to make no changes to the file server, so it's probably best for you.
answered 05 Oct '16, 09:48