Sql-server – Create a linked server with SQL Server 2012 x64

linked-serversql server

How can I create a linked server to a folder having fox pro dbf files?

I can access the dbfs inside Visual Studio 2010, creating a connection with this properties

Connection string

Dsn=Legacy;dbq=\\192.168.48.29\dbf;defaultdir=\\192.168.48.29\dbf;driverid=533;fil=dBase 5.0;maxbuffersize=2048;pagetimeout=5

Provider

.NET Framework Data Provider for ODBC

But I don't know how to use this information with sql server 2012 express x64

I'm trying to use

EXEC master.dbo.sp_addlinkedserver @server = N'LEGACY', @srvproduct=N'Legacy', @provider=N'MSDASQL', @datasrc=N'Dsn=Legacy;dbq=\\192.168.48.29\dbf;defaultdir=\\192.168.48.29\dbf;driverid=533;fil=dBase 5.0;maxbuffersize=2048;pagetimeout=5', @provstr=N'.NET Framework Data Provider for ODBC'

in SQL Server Management Studio

Error message about not finding the dsn …

Best Answer

Drivers for dBase (or Access or Excel) are not installed as part of the SQL Server install. It is likely that VS 2010 installed on your workstation is connecting through the old Jet drivers, which are installed on developer's machines. The problem with Jet is that it was never ported to 64 bit. I don't think that the old Visual FoxPro drivers were ported to 64 bit, either.

Microsoft replaced Jet with "ACE", which is available in 32 and 64 bit packages. ACE drivers were first released with Office 2007 and supplant the older (and probably deprecated) Jet drivers.

You can download the ACE 2010 drivers here. Since you are using a 64 bit server, you want the 64 bit drivers for linked servers. If you plan on running 32 bit packages on the server, you would need to install the 32 bit ACE as well.

You might be able to find a similar package for 2013 by now. I have not used these more recent drivers, so I don't know if the the older formats (like dBase, Fox, etc) are still supported.

After you install the drivers, they generally need additional configuration inside of SQL Server. IIRC, if you see errors that seem to be security-related, you need this additional configuration. In short:

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
GO

Note that running drivers in-process could affect the stability of the instance, if those drivers are buggy.

After the drivers are installed, you will need to configure a valid linked server.

You also need to be sure that SQL Server has permission to read (and maybe write) the files.