Not able to read any content of different server from database server

  • Hi,

    Two different servers A & B

    Env.

    ------

    Database Server (A)

    FTP Server (B)

    Mapped drive on Database server (Z) - this is shared on FTP server

    Scenario

    ------

    I am trying to read any content from drive Z (shared folder on different server - B) which is mapped on A server. using the exec master..xp_fileexist 'Z:\Shared' database server is not retriving anything it returns "0" for everthing. User executing the rights has read & write permission to the Z:

    Appreciate if any suggestion.

    Abhijit - http://abhijitmore.wordpress.com

  • It's important to remeber that ,mappings are available only to the session that created them. Thus, the actual account that is executing the code might not have any drive Z defined...

    Try to use UNC full path (\\SERVER\SHARENAME\PATH\FILE.ext) and see if you get anyting. Also, please pay attention to the following 2 cents:

    1. Path should be denoted as if you were logged in to the SQL server itself. Not you workstation. i.e.: C:\is drice C of the SQL server

    2. The actual account running XP_CMD_SHELL is local system account or anything else defined under Services.msc, not the logged in user

  • Thanks for replying 1st :).

    I did tried with the fullpath of the server as you specified, but it is not returning "0" for all.

    I just want to read the files which are on shread folder, for this i am executing the query from database server.

    Abhijit - http://abhijitmore.wordpress.com

  • OK... let's try this one:

    EXEC xp_cmdshell 'dir *.*';

    and se what is returned.

    just remember to put the proper path instead of *.*

  • I have already tried the command provided. see the problem is I can able to read the files on local drives c:, d: but i am for able to read it on Z: which is mapped drive.

    Abhijit - http://abhijitmore.wordpress.com

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply