VFP ODBC drivers


Generally we write our apps to hit more than one backend.

Various of our routines (e.g., “what is the current database”) have to know the backend type in order to use the appropriate command to return the database name.

To do that, we need to know the connection type before we have created a cursor (if we have created one, the cursoradapter dbtype property does the trick). Note that from the application’s perspective, it was given a connection string and create a connection with it.

To summarize:

1) how to use a handle to find the dbtype in the absence of a cursor?

2) with regard to Lianja ODBC, how to find the current database? Essentially, return database() from the Lianja SQL Server. Note that if the Catalog Column from systables is always the name of the database, this one is solved. If not, then I need another way. IOW: is there a 1:1 correspondence between the database directory name and the .cat file name?


There is no way with ODBC to determine the type of data that you are connected to.

Lianja uses heuristics to do this internally and then sets dbtype as you mentioned.

There is also no way to determine the database that is specified in the ODBC connection string. You can however evaluate an expression and get its value e.g.

select database() from sysresultset

Yes the database directory name and the .cat file are the same.


I need to be able to do select statements from Lianja against the vfp table created by xcase so I can scan though and do the work needed to crate / update table, create indexes in Lianja etc.

Since the tables don’t belong to a datatbase what is the best way to do this? I assume I have to have database to use ODBC?

I have tried with a test table ( this one does belong to a database)

select * from c:\1temp\daddress into cursor temp1

and get an error

Fri Apr 7 18:12:12 2017
**** Lianja error ****
Fatal I/O error writing record 1 to table – errno 22


I’ve just tried to copy one of the tables to a Lianja table using
use c:\1temp\ddent noupdate
copy to c:\1temp\l_ddent with production

and get

Fri Apr 7 21:10:46 2017
**** Lianja error ****
copy to c:\1temp\l_ddent with production
ERROR – invalid record length

Hank tells me that the Xcase case tables are in foxpro 2.x rather than VFP type so maybe that is an issue.


I am able to USE that table and COPY TO another_name to put it in Lianja format.

SQL SELECT is working Ok in 3,.4 with that table too although its not really supported as you need to convert to Lianja format so that the query optimizer can do its work.

Name:  Screen Shot 2017-04-08 at 2.27.43 PM.jpg Views: 27 Size:  89.1 KB

Just USE tablename ALIAS whatever then perform your SQL SELECTSs.

Just an FYI, Lianja supports the following XBase file formats natively readonly.

FoxPro 2.x


in my opinion, the best thing is to create an ODBC link to your xcase table, then create a VT on that table.

With a old FoxPro table, I do that.


Can you make ODBC links to tables that are not part of a database?

The code I have looked at for the ODBC connection wants the name of the database


For free VFP table you need VFP ODBC driver.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.