dbMigration with odbc // curiosity // solved?

This forum is meant for anything you would like to share with other visitors
Post Reply
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

dbMigration with odbc // curiosity // solved?

Post by FFF »

Guys,
for syncing dbf with Postgres tables i use dbMigration, a sub tool of Database.net.
Usually that's all great, but now i found some peculiarity: it reads via odbc a series of dbfs as source - the tool lists all tables in the folder, some preselected for processing, as given by the commandline - but one table is missing. The table is physically there, is used by my apps, it even exists a copy in the folder, which IS shown.
The odbc connection uses the MS VisualFoxpro driver. I even made another user conn, using another version of the driver on my machine - the result is exactly the same.

In the developer's opinion, the odbc driver is at fault, but i can't imagine, what and why the problem exists at all.
Anyone an idea?
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

dbMigration with odbc // curiosity

Post by wriedmann »

Hi Karl,
if you build a small VO sample app using this ODBC driver (the StdMDI SQL Application should be enough): do you see your table?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

dbMigration with odbc // curiosity

Post by FFF »

Hi Wolfgang,
thx, didn't know, this sample exists ;) -
built it, run, selected the datasource, "open a slq-table" - lists the dbfs in the folder, but not that dratted one.
Opened explorer, made a copy of the file, and made a copy of the pre-version (which was corrupt) - the latter is shown, while the first is invisible like its parent.
There's no problem at all opening it with the rdd/dbserver.
Strange...
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

dbMigration with odbc // curiosity

Post by wriedmann »

Hi Karl,
maybe this table has a field that is not valid for FoxPro?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

dbMigration with odbc // curiosity

Post by FFF »

8 fields, each "character", length 2, 4, 5 and 60...
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

dbMigration with odbc // curiosity // solved?

Post by FFF »

Guys,
to bring this to a conclusion: just tried and let cmVODBX make a "safe copy" of my problem dbf, what basically makes a new dbf using the struc and copy recordwise.
And behold, this one gets listed by odbc.:P

Ok, compared both of them with WinMerge and there's ONE difference, the first four hex values in the header are
07 15 02 10 in the "problem" and
03 15 03 1E in the working version

Had had a look to file format definitions, where 0x03 means FoxBASE+/Dbase III plus, no memo (which is correct, this file has no memo field)
but i find no info for 0x07 in the first byte

As all my checks seem to work fine with the copy, i'm solved - but nevertheless, would like to understand what went wrong here.
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

dbMigration with odbc // curiosity // solved?

Post by robert »

Karl,
First byte 0x07 is VO Ansi DBF. And first byte 0x87 is VO Ansi DBF with DBT.
When you create a DBF with the DBFNTX driver in VO and when you have SetAnsi(TRUE) then you get this type of file.
X# can read/write that.
See https://github.com/X-Sharp/XSharpPublic ... s.prg#L105 for a list of types that X# knows about.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FFF
Posts: 1521
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

dbMigration with odbc // curiosity // solved?

Post by FFF »

Robert,
thx for this. All of my dbfs are CDX, all created with VO many moons ago. The ones with Memo are "0xF5", i.e. Foxpro2 (!)? The memo-less ones 0x03, i.e. "FoxBaseDBase3NoMemo".
Slightly confusing, the whole thing, especially, why 0x07 isn't seen by odbc 3.00...
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

dbMigration with odbc // curiosity // solved?

Post by robert »

Karl,
FFF wrote:Robert,
Slightly confusing, the whole thing, especially, why 0x07 isn't seen by odbc 3.00...
I do not think that the ODBC driver recognizes NTX files as well.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

dbMigration with odbc // curiosity

Post by mainhatten »

FFF wrote:In the developer's opinion, the odbc driver is at fault, but i can't imagine, what and why the problem exists at all.
Anyone an idea?
As the original problem is already solved, let me add some vfp view:
DO NOT USE VFP ODBC DRIVER IF YOU CAN CODE AROUND IT.
The vfp ODBC driver has not been updated (IIRC from version 6) to keep in synch with newer features and additions.

Code depending on it might work for long stretches, but then you need to access a table sporting one of the benefits added later, for instance BINARY index, and boom - you are out of luck and have to code around it, ask for other table or import format - things we dislike to do as it runs against DRY.

OLE DB as access technology much safer, either in old COM/ActiveX surroundings as well as in ADO.Net - if the tool you use needs an ODBC driver (might be Linux based), use one from Advantage (from Advantage 10 or higher), it will work much further with newer vfp table features.

If everything fails, fire up vfp as a COM object, access table in native vfp and pass the info back as stream, XML, JSON or create a file format to import in a cursor.

Edit: see
http://fox.wikis.com/wc.dll?Wiki~VFPODBCdriver
for more details, like field types VarChar, AutoInc under "Can't" header...

regards
thomas
Post Reply