2

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 ...

2
  • It would help if you printed the exact error message, but as a complete guess either a) the DSN exists on your workstation where VS runs but not the server where SQL Server runs, or b) the DSN is a user DSN and therefore not visible to the SQL Server service account. If it's a), create the DSN on the server; if it's b) make it a system DSN. If neither, post the precise error.
    – Pondlife
    Commented Nov 2, 2012 at 19:54
  • After adding the linked server, when I try access the tables I got: Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc) ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "LEGACY". (Microsoft SQL Server, Error: 7303) For help, click: go.microsoft.com/… Commented Nov 2, 2012 at 22:39

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.