Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Posts
    4

    Unanswered: Accessing Btrieve files using W32MKDE & Btrieve API

    I'm trying to read information from Lytec Chiropractic 2001 files which use Btrieve 6.15. I was originally tempted to use the OLEDB provider, but it looks like this requires you to install the Workgroup Engine, and I wanted to avoid this. I've heard that you can use the Btrieve API to talk to the Microkernel directly, thereby eliminating the need for the Pervasive V8 Workgroup Engine, however, getting this to work is another story.

    I've followed the Btrieve API guides on the Pervasive site, and have managed to get the demonstration C program compiled and working, which is able to read the data from the sample1.btr file. The only problem is when I move this exe to another computer which simply has Lytec installed, it fails to work (ie, it gives me a return code of 8020 when I run it, probably meaning that it can't find a Btrieve engine). Once I install the Workgroup Engine for Pervasive SQL V8, everything works, but like I said, I wanted to avoid this.

    Lytec installs a copy of the Btrieve 6.15 Microkernel (called W32mkde) and I notice that whenever Lytec is started, it also opens up the Microkernel Database Engine.. So what I'm wondering is why my C program is unable to detect or connect to this Btrieve Microkernel. If anyone has any tips or suggestions, please let me know, cause I'd really like to get this working without requiring the V8 Workgroup Engine. Thanks,

    Adam

    P.S. I should mention that I have all the required DDF's, but I'm not even at the point yet where I need them.

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    The 8020 is an error indicating a missing component. If you've compiled the sample included with the V8 SDK, then the default library is W3BTRV7.LIB which not supported with Btrieve 6.15. Btrieve 6.15 needs to use WBTRV32.LIB. In addition, you'll need to know the exact byte record structure for the Lytec data.
    DDFs would only be needed for ODBC, OLEDB, ActiveX, or JDBC.
    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.

  3. #3
    Join Date
    Oct 2003
    Posts
    4
    Thanks for the reply Mirtheil.. Any idea where I can obtain this WBTRV32 library? I found a knowledge base article on the Pervasive web site which discusses WBTRV32.LIB, (http://www.pervasive.com/support/tec...5/b615prog.pdf) and it looks like it used to be availble as a free Btrieve 6.15 SDK download, but of course the new Btrieve SDK only includes W3BTRV7.LIB. Lytec includes the WBTRV32.DLL, so it looks like all I need now is the WBTRV32.LIB file (and possibly some instructions, if the implementation differ enough from the W3BTRV7 library).

    Also, you mention that I'll need to know the exact byte record structure for the Lytec data.. Isn't that where the DDF's will be able to help me? Thanks again,

    Adam

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    Unfortunately, Btrieve 6.15 went unsupported as of March 2000 (according to Pervasive's lifecycle web page) and so the lib is not available any longer. This also speaks to the fact that 6.15 hasn't been tested on Windows 2000, Windows XP, or any of the newer OSes.
    As far as getting the LIB, I'm not sure what you can do other than use an implib program to create a LIB from the DLL. THe API functions are actually the same as for W3BTRV7.LIB and so you should be able to change the LIB out, recompile and it should work.
    The DDFs can give you the record structure but the Btrieve API does not use DDFs. You would have to read the DDFs and then calculate the record structure from that.
    Have you considered upgrading to Pervasive.SQL V8? It's got the ODBC (or OLEDB) driver to make development easier and is supported on newer OSes.
    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.

  5. #5
    Join Date
    Oct 2003
    Posts
    4
    Originally posted by mirtheil
    Unfortunately, Btrieve 6.15 went unsupported as of March 2000 (according to Pervasive's lifecycle web page) and so the lib is not available any longer. This also speaks to the fact that 6.15 hasn't been tested on Windows 2000, Windows XP, or any of the newer OSes.

    That's too bad.. I wonder what the legal issues are surrounding the redistribution of the 6.15 SDK, just in case anyone happens to have a copy.. Is it even possible to purcahse it? It's a shame they don't make available these older (or obsolete) tools, as there is definitely still a need for them. I really like how Borland provides a "Museum" with free downloads of most of their old programming tools, I wish other companies would follow suit.

    As far as getting the LIB, I'm not sure what you can do other than use an implib program to create a LIB from the DLL.
    I'm not familiar at all with creating a LIB from a DLL. I tried to use the LIB.EXE program included with VC++ to make a LIB file from the WBTRV32.DLL, but it didn't seem to work.. I tried issuing the command "LIB /DEF:WBTRV32.DLL" but I get a few of the following warnings: "WBTRV32.DLL : warning LNK4017: MZÉ statement not supported for the target platform; ignored", and it produces a subsequent bogus WBTRV32.LIB file, which is only about 3k, which I'm sure is incorrect, since the W3BTRV7.LIB file is around 24k. I've also tried another tool called "ImpLib32 Version 1.02", but although that didn't produce any warnings, it also created a small 2k LIB file.

    Do you have any other suggestions for implib tools I may want to try? I've seen a few other ones that look interesting, like the Digital Mars IMPLIB program (http://www.digitalmars.com/ctg/implib.html) but there's no way to try before you buy, and I may get stuck with a useless program if it doesn't convert the DLL successfully.


    The DDFs can give you the record structure but the Btrieve API does not use DDFs. You would have to read the DDFs and then calculate the record structure from that.
    As long as it contains enough information for me to be able to write an equivalent c struct, that's all I need.

    Have you considered upgrading to Pervasive.SQL V8? It's got the ODBC (or OLEDB) driver to make development easier and is supported on newer OSes.
    Yes, I have considered upgrading to Pervasive.SQL V8, but there are a few drawbacks. The minimum required to connect to a database is the V8 Workgroup Engine, which costs $25 per user, and is also about a 70 meg download from the Pervasive site (and about 8 megs for the V8 OLE DB Provider).

    I do most of my distribution through a web site, and many of my clients are still using dial up access, so it's pretty much impossible to get them to download a 70 meg Workgroup engine. But since all of them have Lytec Chiropractic installed, which comes with W32MKDE, I was hoping that I would be able to use the Btrieve 6.15 API to connect to this engine and obtain the necessary information from the data files, without having to install the V8 Workgroup Engine. This, I believed, would be a much more seamless and hassle free way of implementing my program.

    Are you absolutely sure that the new API is unable to connect to an older engine, such as the v6.15 MKDE? After some playing around, I was actually able to get the sample C program (which is linked against W3BTRV7.LIB) to see that the 6.15 engine is installed on the computer.. What I did was start the sample C program, which then opens up the V8 Workgroup Engine and prints out the installed versions of Btrieve, which are 8.0 N, 8.10 9 and 8.10 9 again. If I then click on the V8 Workgroup Engine and select "Stop Engines and exit", then start up Lytec Chiropractic (which automatically starts the W32MKDE), then run th sample C program again, the versions returned now become: 8.0 N, 6.15 9 and 6.15 9.

    But the program then is unable to connect to the sample database (I get an error 30, which I think means that the btrieve file is newer than the engine with which you're trying to access it through). So it looks like it actually is using the 6.15 engine, and cannot access the sample1.btr file, since it was made with Pervasive SQL V8. I just don't know how to get this sequence of events to occur without first having to install the V8 Workgroup Engine. I'm thinking that after install of the V8 Workgroup Engine, it sets some registry value, or some ini file or something, that enables the C sample program to see the v6.15 engine.. I just can't figure out what it actually does to enable this.

    Sorry for rambling on, but if you can make sense of any of the above, and have any suggestions, your help would be most appreciated. Thanks for your time,

    Adam

  6. #6
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    That's too bad.. I wonder what the legal issues are surrounding the redistribution of the 6.15 SDK, just in case anyone happens to have a copy.. Is it even possible to purcahse it? It's a shame they don't make available these older (or obsolete) tools, as there is definitely still a need for them. I really like how Borland provides a "Museum" with free downloads of most of their old programming tools, I wish other companies would follow suit.
    AS far as the legal implications, I know, as an owner of the 6.15 SDK, that I'm not legally able to distribute the library. While it would be nice for companies to have old products available, I can see why a company wouldn't want to support the old products. Even if a copmany says they don't support old products, putting the files on a web site can, to some people, imply support for those files.

    I'm not familiar at all with creating a LIB from a DLL. I tried to use the LIB.EXE program included with VC++ to make a LIB file from the WBTRV32.DLL, but it didn't seem to work.. I tried issuing the command "LIB /DEF:WBTRV32.DLL" but I get a few of the following warnings: "WBTRV32.DLL : warning LNK4017: MZÉ statement not supported for the target platform; ignored", and it produces a subsequent bogus WBTRV32.LIB file, which is only about 3k, which I'm sure is incorrect, since the W3BTRV7.LIB file is around 24k. I've also tried another tool called "ImpLib32 Version 1.02", but although that didn't produce any warnings, it also created a small 2k LIB file.

    Do you have any other suggestions for implib tools I may want to try? I've seen a few other ones that look interesting, like the Digital Mars IMPLIB program (http://www.digitalmars.com/ctg/implib.html) but there's no way to try before you buy, and I may get stuck with a useless program if it doesn't convert the DLL successfully.[/SIZE]
    You need to make sure you are using the write WBTRV32.DLL. The WBTRV32.DLL included with Pervasive.SQL V8 is a shim that only passes calls to the W3BTRV7.DLL. You would want to make sure you use a 6.15 WBTRV32.DLL.


    As long as it contains enough information for me to be able to write an equivalent c struct, that's all I need.
    It should, if the DDFs define the tables properly.


    Yes, I have considered upgrading to Pervasive.SQL V8, but there are a few drawbacks. The minimum required to connect to a database is the V8 Workgroup Engine, which costs $25 per user, and is also about a 70 meg download from the Pervasive site (and about 8 megs for the V8 OLE DB Provider).

    I do most of my distribution through a web site, and many of my clients are still using dial up access, so it's pretty much impossible to get them to download a 70 meg Workgroup engine. But since all of them have Lytec Chiropractic installed, which comes with W32MKDE, I was hoping that I would be able to use the Btrieve 6.15 API to connect to this engine and obtain the necessary information from the data files, without having to install the V8 Workgroup Engine. This, I believed, would be a much more seamless and hassle free way of implementing my program.
    The 70 MB download is a full install with all of the docs, utilities and engine. The OLEDB is not required as a separate download when using V8. In addition, it can be pared down by removing the docs and/or utilities if they are not going to be used. The main thing to be aware of would be to check with Lytec to see if they'll support V8.

    Are you absolutely sure that the new API is unable to connect to an older engine, such as the v6.15 MKDE? After some playing around, I was actually able to get the sample C program (which is linked against W3BTRV7.LIB) to see that the 6.15 engine is installed on the computer.. What I did was start the sample C program, which then opens up the V8 Workgroup Engine and prints out the installed versions of Btrieve, which are 8.0 N, 8.10 9 and 8.10 9 again. If I then click on the V8 Workgroup Engine and select "Stop Engines and exit", then start up Lytec Chiropractic (which automatically starts the W32MKDE), then run th sample C program again, the versions returned now become: 8.0 N, 6.15 9 and 6.15 9.
    Yes, I'm sure there's no way to make a newer engine component talk to the older engine. It's not a new API. THe API is exactly the same between the versions. THe difference is in the DLL the application links to. The reason it seems to work if you shut down the V8 engine is that the component (W3BTRV7.DLL) is available on the machine. That component is not included, nor supported, with the Btreive 6.15 engine. If that component is not available when linking to W3BTRV7.LIB, then the status 8020 will occur. The easiest way to see this is to rename W3BTRV7.LIB and try your test again. You'll get the 8020, 3014, or a 3012.

    But the program then is unable to connect to the sample database (I get an error 30, which I think means that the btrieve file is newer than the engine with which you're trying to access it through). So it looks like it actually is using the 6.15 engine, and cannot access the sample1.btr file, since it was made with Pervasive SQL V8. I just don't know how to get this sequence of events to occur without first having to install the V8 Workgroup Engine. I'm thinking that after install of the V8 Workgroup Engine, it sets some registry value, or some ini file or something, that enables the C sample program to see the v6.15 engine.. I just can't figure out what it actually does to enable this.
    The status 30 is being returned because the 6.x engine cannot read 7.x or 8.x file formats. It's not setting any registry or INI settings. It's a component that's installed.
    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.

  7. #7
    Join Date
    Oct 2003
    Posts
    4
    Thanks again for the reply Mirtheil. So I was finally able to figure out how to make a library from the WBTRV32.DLL file, using the MS tools DUMPBIN and LIB included with VC++. I had to dump the exports section of the WBTRV32.DLL file and then add the stack size and ordinance of each function to the file, then use LIB to create the WBTRV32.LIB file. It turned out to be much smaller than the W3BTRV7.LIB file (3k compared to 24k) but it works perfectly, and I'm able to connect and execute statements using BTRVID to the 6.15 MKDE.

    As a bonus, the same code works with both Lytec Chiropractic 2001 and Lytec Medical XE (which use the Btrieve 6.15 and Pervasive SQL.V8 engines respectively). So now my program doesn't even require the user to add any additional software, and the size of the distributed executable will be very small.

    I wanted to ask you though, is it possible to start up either the Btrieve 6.15 MKDE or the Pervasive SQL.V8 Workgroup Engine from within a C program? I looked through the Btrieve API reference, but was unable to find a way to actually launch the desired engine (probably because the API is no use if the engine isn't running to begin with). What I'm wondering is how Lytec is able to start off the 6.15 MKDE in the background. Because if I simply double click on the 6.15 MKDE icon in the Lytec folder, it opens the Engine, but not in the background, so the user is able to actually quit the program - without invoking the task manager.

    I could, as a requirement, instruct the user to always open their Lytec program (which will subsequently load the desired engine), before attempting to run my C program, but I was just wondering if it was possible to do this without that requirement.

    Also, when running my C program, it requires that the WBTRV32.DLL be in the same directory as the executable. Is there any way to compile this dll into my program so it doesn't require this file?

    And lastly, when retrieving records, is there any way to retrieve an entire set of records (matching a given criteria), and then go through them one by one using some kind of loop, or do you have to continually execute a request to the engine to return records? For example, in my program right now, I simply use B_GET_FIRST to get the first record from the file, and then use a loop that requests the next record from the file by using B_GET_NEXT and terminates when success!=B_NO_ERROR. In other database systems, such as DB2, you can retrieve an entire set of records from the database, and then traverse through them in your C program without continually polling the database engine.

    Any suggestions are greatly appreciated. Thanks,

    Adam

  8. #8
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    As a bonus, the same code works with both Lytec Chiropractic 2001 and Lytec Medical XE (which use the Btrieve 6.15 and Pervasive SQL.V8 engines respectively). So now my program doesn't even require the user to add any additional software, and the size of the distributed executable will be very small.
    That's to be expected, the WBTRV32.DLL has been included with Btrieve 6.15, Pervasive.SQL 7.0, 2000, and V8 and works exactly the same for all versions.

    I wanted to ask you though, is it possible to start up either the Btrieve 6.15 MKDE or the Pervasive SQL.V8 Workgroup Engine from within a C program? I looked through the Btrieve API reference, but was unable to find a way to actually launch the desired engine (probably because the API is no use if the engine isn't running to begin with). What I'm wondering is how Lytec is able to start off the 6.15 MKDE in the background. Because if I simply double click on the 6.15 MKDE icon in the Lytec folder, it opens the Engine, but not in the background, so the user is able to actually quit the program - without invoking the task manager.
    Actually, the first call to Btrieve will attempt to start the engine. You need to make sure the engine is in the system path. Once it's in the system path, any application that calls the Btrieve engine will automatically start it.

    Also, when running my C program, it requires that the WBTRV32.DLL be in the same directory as the executable. Is there any way to compile this dll into my program so it doesn't require this file?
    This is the same as above. The WBTRV32.DLL needs to be in the system path. Once it's there, you won't need it in your application directory.

    And lastly, when retrieving records, is there any way to retrieve an entire set of records (matching a given criteria), and then go through them one by one using some kind of loop, or do you have to continually execute a request to the engine to return records? For example, in my program right now, I simply use B_GET_FIRST to get the first record from the file, and then use a loop that requests the next record from the file by using B_GET_NEXT and terminates when success!=B_NO_ERROR. In other database systems, such as DB2, you can retrieve an entire set of records from the database, and then traverse through them in your C program without continually polling the database engine.
    You can use a Get Next Extended to retrieve a set of records. I have found in my applications, the performance of the GetFirst/GetNext loop is sufficient for most situations. One thing to remember is that you don't have to go through the entire file. You can use a GetEqual or GetGreaterOrEqual type operation to start at the record you want and then use GetNext and check the KeyBuffer return to make sure you're still in the range you want and then stop searching once you get past the record.
    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.

Posting Permissions

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