Author: Edward Leafe
Posted: 2026-10-19 at 17:46:38
On Oct 19, 2026, at 17:27, Edward Leafe <ed@leafe.com> wrote:
>
> I’m surprised you didn’t ask Claude to help write a 32-bit ODBC driver for you! 😁
… so I did!
============================================================================================
> Would it be possible to write a 32-bit driver for DuckDB that could be used by Visual FoxPro 9? I don't know C/C++ or any other language that drivers are typically written in.
Yes, it’s possible in principle, but a true 32-bit driver is the hardest route. Easier ways to get VFP 9 talking to DuckDB exist, and none of them require you to learn C++.
Why it’s hard: VFP 9 is a 32-bit process, so it can only load 32-bit DLLs and 32-bit ODBC drivers. DuckDB’s official Windows builds, including the ODBC driver, are 64-bit only. Building a 32-bit version means compiling DuckDB from source in C++, and 32-bit Windows isn’t an officially supported target, so you’d be fighting build problems with no one to ask. I’d rule that out. (This is from my knowledge, so check DuckDB’s current release page in case it has changed.)
Practical options, easiest first:
1• Shell out to the DuckDB CLI. duckdb.exe is a 64-bit standalone program, and a 32-bit VFP app can still launch it. VFP writes a SQL string, runs it (via WScript.Shell or RUN), DuckDB exports the result to a CSV or JSON file, and VFP loads it with APPEND FROM ... TYPE CSV or similar. This takes about 20 lines of VFP code and needs no other language. It’s slowish per call because of process startup, so it suits reports, imports and batch work better than row-by-row lookups.
2• A small 64-bit helper service. A short Python script (a few dozen lines, using the duckdb package) listens on localhost HTTP, accepts SQL and returns JSON or CSV. VFP calls it with MSXML2.ServerXMLHTTP, which works fine in VFP 9. It keeps the database open between calls, so it’s much faster than option 1 and supports interactive use. I can write both the Python and the VFP side for you.
3• Use SQLite as the bridge. SQLite has solid 32-bit ODBC drivers that VFP handles well through SQL pass-through (SQLSTRINGCONNECT, SQLEXEC). DuckDB can read and write SQLite files, so you do the heavy analytics in DuckDB and exchange results with VFP through a SQLite file. It’s a good fit if you want normal-feeling VFP data access.
4• Exchange files. Parquet, CSV and JSON all work between the two, and DuckDB is very good at reading and writing them.
If your goal is analytics on large data, with VFP as the front end, I’d start with option 2, or option 1 if you want to avoid installing anything beyond duckdb.exe.
What is VFP doing in your setup: a desktop app that needs query results on screen, or batch processing? And do you have Python available, or do you want to avoid installing it? With that I can write the VFP code and any helper script for you.
============================================================================================
So it sounds like you ended up with a hybrid of #1 and #3. Of course, I would have gone with the Python option!
-- Ed Leafe