Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2015
    Posts
    1

    Unanswered: Read Data from Pervasive DAT files with C# / ODBC

    Hello,

    I am trying to read data out of a Pervasive 10 based application using C# and struggling getting all things right.

    The Pervasive Engine and ODBC drivers work fine and I can use them easily.

    My issue is basically the application. I got a DDF file, but this is a singel file in text format describing the data-tables within the DAT files. This file can't be used by Pervasice Control Center to access the database.

    I also got a manual for this text based DDF and based on this information I can tell exactly where the fields within a specific table reside, what the column-name is and what data type is used. However, the developer of that application programmed the Database in a way where the first character in each row (within the DAT file) defines it's own data area. As far as I understand the developer just placed more than one table within one data file and differenciates thos with the first character.

    I already tried to add a table within Control Center to enable easy ODBC access - but I don't find any configuration option where I can specify this data area thing.

    Based on the information I have I could write my application to just parse the data files (which has, of course, many drawbacks) but this is not what I would like to do. Therefore my question to the Pros here. Do you guys see a chance to open those files with a ODBC connection to the database rather to parse all data files with a text parser?

    Actually I don't want to change or add any records within the DB - the only need I have is to read data out of it.

    Your help is really appreciated!

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    To use ODBC, you need "real" DDFs (FILE.DDF, FIELD.DDF, and INDEX.DDF at least).
    It sounds like you've got a "variant" record structure because of the multiple table structures. Creating DDFs for variant records is not always easy because of indexes.
    Using the information you have for the record structures, you can create multiple table entries, one for each record structure. You would need to make sure to have that first character as a column and use it to limit which records are returned. For example, if you have record types 'A', 'B', and 'C', you would define three tables (A, B, and C). Then when selecting, you would add a WHERE clause limiting to records to the ones that match the structure.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •