5

We're trying to access Foxpro file-based database files via MSSQL Server's linked server feature, using Foxpro ODBC driver.

For this, we've

  • installed the latest Foxpro ODBC Driver from Microsoft,
  • made a System DSN which is using this driver
  • chose the "Visual FoxPro database (.DBC)" option under Database type, instead of "Free table directory"
  • specified the path to our dbc file (on local machine)
  • installed MSSQL Server 2008 R2 Express
  • installed MSSQL Server Management Studio 2008
  • tried to create a new linked server by using a GUI wizard like this: New Linked Server screenshot

But the last step never completes (Executing is displayed forever). When Management Studio is forcibly closed and restarted the new linked server is there but only contains Catalogues subitem. If we try to expand it, Management Studio goes into loop yet again.

Henno
  • 1,046
  • 5
  • 19
  • 33
  • When tracing is enabled from ODBC applet, http://pastie.org/3401873 appears in the file. – Henno Feb 17 '12 at 15:12

2 Answers2

6
  • Download and install Microsoft OLE DB Provider for Visual FoxPro
  • Make sure it appears in MSSQL Management Studio, under System Objects > Linked Servers > Providers, as "VFPOLEDB". I had to install it, uninstall it and re-install it until I got it there (and no, restarting Windows did not work).
  • Open System Objects, right click Linked Servers and choose to add a new linked server.
  • Fill the form as like this:screenshot of New Linked Server with proper values for Foxpro connection
    • No need to add any DSNs in ODBC applet
    • Click OK and see if you can now drill down the new linked server until you see the tables.
    • Right click on some table and script a SELECT query to new query window. This gives you an example how to query this new linked server:
      SELECT * FROM [myLinkedServer]...[myTable]
Henno
  • 1,046
  • 5
  • 19
  • 33
  • 1
    Henno's answer worked perfectly just after enabling Provider options in Properties od VFPOLEDB Provider entry. I also needed to reinstall the VFPOLEDB:-) I am not sure, whether all the parametres should be enabled, but after that I could connect the tables and it worked fine. –  Aug 11 '15 at 08:42
0

The first thing to do is to make sure that you are using 32 bit drivers if you have a 32 bit SQL Server and 64 bit drivers if you are using a 64 bit SQL Server. 64 bit SQL Servers can't use 32 bit ODBC (or OLEDB or anything else) drivers.

I have had the old ODBC drivers from Microsoft bring down server instances, so i avoid them.

On recent versions of SQL Server, 2005+, I've had the best success with the "ACE" drivers. These drivers replace the old "JET" drivers and were introduced with Office 2007. They are OLEDB based, but you wouldn't necessarily notice. The release for Office 2010 that comes in 32 bit and 64 bit versions. The redistributable ACE drivers are available for download on Microsoft's site.

With the new drivers, you don't need to create a system DSN like with the old ODBC drivers. You can just create the linked server and go. There should be plenty of examples of how to create linked servers using ACE drivers (both with TSQL and the SSMS GUI) on the internet.

You will want to be sure that the provider representing your drivers (look under the Linked servers folder for the Providers folder) is set to "Allow in process" and .

You may also find that accessing files on the network is harder than accessing the same file on a local disk. This is usually a problem with delegation and security. Getting that going can be a hassle, depending on your infrastructure.

(If you are interested, I did a few of blog entries "Legacy Connectivity in a 64 bit world" about three or four years ago, covering dbase/foxpro issues, 32/64 bit issues, plus db/2 and other stuff. There is probably more than there than you would want to read. This was back before the 64 bit ACE drivers were released, and things are better now.)

Darin Strait
  • 2,012
  • 12
  • 6