title: Error querying dbf file from network share using Microsoft.ACE.OLEDB.12.0
body: <p>Windows Server 2008 R2 x64 SP1,
  Sql Server 2008 x64 SP3,
  Access Database Engine x64 SP1</p>
  
  <p>I have linked server:</p>
  
  <pre><code>EXEC master.dbo.sp_addlinkedserver @server = N'dbf2', @srvproduct=N'dbf2', @provider=N'MSDASQL', @provstr=N'DRIVER={Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)};'
  </code></pre>
  
  <p>When querying dbf file from local disk everything is OK:</p>
  
  <pre><code>select * from openquery(dbf2, 'select * from c:\\V4C8MA6.dbf') a
  </code></pre>
  
  <p>But when querying from network share </p>
  
  <pre><code>select * from openquery(dbf2, 'select * from \\\\gefest\\upload\\V4C8MA6.dbf') a
  </code></pre>
  
  <p>I've got the error:</p>
  
  <pre><code>Msg 7399, Level 16, State 1, Line 6
  The OLE DB provider "MSDASQL" for linked server "dbf2" reported an error. The provider did not give any information about the error.
  Msg 7350, Level 16, State 2, Line 6
  Cannot get the column information from OLE DB provider "MSDASQL" for linked server "dbf2".
  </code></pre>
  
  <p>I've tried different variants to describe the path: [], "", ``, \"\", ....
  Everything is OK with the nework share access, the sql server account has needded access rights. But...</p>
  
  <p>How to make it work?</p>
  
  <p><strong>Added on 04 may 2012:</strong></p>
  
  <p>xp_cmdchell lists the directory perfectly.</p>
  
  <p>This is what I discovered:
  I created linked server with sprovstr indicating the location of the file:</p>
  
  <pre><code>@provstr=N'DRIVER={Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)};dbq=\\gefest\upload'
  </code></pre>
  
  <p>This works if I connect to the sql server using <strong>sql server auth</strong>.</p>
  
  <p>This is what ProcMon shows when using <strong>dbq</strong>:</p>
  
  <p>Date &amp; Time:    5/4/2012 9:57:55 AM
  <br>Event Class:    File System
  <br>Operation:  CreateFile
  <br>Result: <strong>SUCCESS</strong>
  <br>Path:   \\gefest\upload\
  <br>TID:    8588
  <br>Duration:   0.0001988
  <br>Desired Access: Read Attributes
  <br>Disposition:    Open
  <br>Options:    Open Reparse Point
  <br>Attributes: n/a
  <br>ShareMode:  Read, Write, Delete
  <br>AllocationSize: n/a
  <br>OpenResult: Opened</p>
  
  <p>This is when indicating <strong>path in the query</strong>:</p>
  
  <p><br>Date &amp; Time:    5/4/2012 9:58:53 AM
  <br>Event Class:    File System
  <br>Operation:  CreateFile
  <br>Result: <strong>OBJECT PATH INVALID</strong>
  <br>Path:   \\gefest\upload\
  <br>TID:    8588
  <br>Duration:   0.0000819
  <br>Desired Access: Read Attributes
  <br>Disposition:    Open
  <br>Options:    Open Reparse Point
  <br>Attributes: n/a
  <br>ShareMode:  Read, Write, Delete
  <br>AllocationSize: n/a</p>
  
  <p>Why sql server receives desired access to the share at the first query and does not at the second?</p>
  
  <p>The third and fourth variants are when connecting to the server using <strong>windows auth</strong>:</p>
  
  <p>using <strong>dbq</strong>:</p>
  
  <p><br>Date &amp; Time:    5/4/2012 10:02:54 AM
  <br>Event Class:    File System
  <br>Operation:  CreateFile
  <br>Result: <strong>ACCESS DENIED</strong>
  <br>Path:   \\gefest\upload\
  <br>TID:    8588
  <br>Duration:   0.0031837
  <br>Desired Access: Read Attributes
  <br>Disposition:    Open
  <br>Options:    Open For Backup, Open Reparse Point
  <br>Attributes: n/a
  <br>ShareMode:  Read, Write, Delete
  <br>AllocationSize: n/a
  <br><strong>Impersonating:    GAZ\kozlovai</strong></p>
  
  <p>indicating <strong>path in the query</strong>:</p>
  
  <p><br>Date &amp; Time:    5/4/2012 10:02:20 AM
  <br>Event Class:    File System
  <br>Operation:  CreateFile
  <br>Result: <strong>OBJECT PATH INVALID</strong>
  <br>Path:   \\gefest\upload\
  <br>TID:    8588
  <br>Duration:   0.0000378
  <br>Desired Access: Read Attributes
  <br>Disposition:    Open
  <br>Options:    Open For Backup, Open Reparse Point
  <br>Attributes: n/a
  <br>ShareMode:  Read, Write, Delete
  <br>AllocationSize: n/a
  <br><strong>Impersonating:    GAZ\kozlovai</strong></p>
  
  <p>Sql server impersonates when connecting to the share. And this account 'GAZ\kozlovai' has full access to the share, but sql server still cannot open the file...</p>