BDE - tecnical info 2770
|Top Previous Next|
NUMBER : 2770
PRODUCT : BDE
VERSION : All
OS : Windows
DATE : August 5, 1996
TITLE : BDE Frequently Asked Questions.
BDEVTOOLS SECTION #4 - Borland DB Engine 3/23/95
This document contains information most often provided to
users of this section. First, there is a listing of common
Technical Information Documents (TI's) that can be
downloaded from the libraries and are also available through
the TechFax line of Borland Assist. Following the TI list,
there is a listing of the most frequently asked questions
TECHNICAL INFORMATION DOCUMENTS
TI2546.ZIP Problem Report Form.
TI2656.ZIP Function mapping from the Paradox Engine to BDE.
TI2751.ZIP Some Internal BDE Limits (can change at any time).
TI2752.ZIP Local SQL Reserved words.
TI2761.ZIP Getting started using the BDE.
TI2762.ZIP Comparison filters.
TI2763.ZIP Using a continue node in a Filter.
TI9410.ZIP Overview information on the BDE.
FREQUENTLY ASKED QUESTIONS AND ANSWERS
2) Paradox Specifics
3) dBASE Specifics
Q: Is there any "Getting started" information on the BDE?
A: Yes - get the file TI2761.ZIP for information on getting
started with the BDE.
Q: What's the difference between Paradox for Windows and the
Borland Database Engine (BDE)?
A: Paradox for Windows is a database Application and
development system. The BDE is a programming
tool allowing C, C++, and Pascal programmers access to
Paradox, dBASE, Text, as well as other data sources using
either the Borland SQL Links for Windows native drivers,
or using third-party ODBC drivers. The BDE contains the
core DLLs that Paradox for Windows, as well as dBASE for
Windows, use for their core data access. More general
information on the BDE can be found in the file
Q: What basic steps can I follow to make my BDE application
A: 1) Increase stack size to 20K.
2) Increase the number of file handles available to your
application using the Windows API function
3) Check the return values of each and every BDE function
call and provide some means for handling the result of
any return value other than DBIERR_NONE. (See next
4) Take a look at TI2761.ZIP, which describes the basic
steps that are required in setting up a BDE
Q: I'm having trouble with my program, and the debugger has
traced the problem into a BDE DLL. Does this mean that
there is a bug in the BDE?
A: Not necessarily. Frequently if a prior call to the
BDE has failed due to being passed an invalid handle or
for some other reason, this will leave the BDE in an
unpredictable state which will later cause a GP fault.
The solution is to check the return values of each and
every function call you make. The BDE sample applications
contain error handling routines.
Q: Why is my application having problems when share is
A: One possibility is that share could be running out of
locks or file handles. The command line 'share /L:200
/F:4096' will increase the number of files that can be
locked to 200 and the memory available for files to 4096
(the default is 20 and 2048). See your DOS or WINDOWS
manual for more information on share.
Q: Is there a version of the Database Framework (DBF) for the
BDE? Is there a C++ Framework for the BDE?
A: An example framework, roughly 95% compatible with the
Paradox Engine DBF, is available on CompuServe in the
BDEVTOOLs forum, LIBrary 4: KDBF.ZIP.
Q: Why am I getting the error: "Could not initialize IDAPI -
not initialized for accessing network drives" when
attempting to open a table on a network?
A: 1) Make certain the network control directory (NET DIR) is
set to a directory on the network (not local). This is
set in the BDE Configuration utility.
2) Make certain that you have read/write/create rights to
the network control directory, as well as the directory
containing the table.
3) Make certain that the private directory is set to a
local directory. For example, in the Database Desktop
(DBD), the private directory is set in the WIN.INI
file, in the [DBD] section, PrivDir. If it is set to a
directory on the network, this error can occur.
4) Old lock files exist in the private directory. Either
the application previously crashed, resulting in
improper cleanup, or another application is using the
same private directory.
5) Under Windows for Workgroups (WfW), search your hard
drive for the NWCALLS.DLL. Rename/backup the older
versions of this file and run again.
If this fails to resolve the problem, you will need to
make certain to not use the NetBEUI protocol as the
default network protocol in Windows Setup. Select
NetWare (or some other protocol) as the networking
protocol, and everything should work successfully.
Q: Why am I getting the error "Cannot find NetWare.DLL"?
A: An outdated netware.drv is found in the System.ini file.
A newer version of this file should be gotten from your
network administrator, and/or Novell.
Q: How do I use the BDE in a DLL that is called from Paradox
for Windows or dBASE for Windows?
A: Make certain to use dynamic linking when using the
BDE in a DLL called from another application. This will be
done automatically when using the IDAPI.LIB that ships
with the BDE, but will not be done if an import library
was created using IMPLIB (the shipping IDAPI.LIB is more
than a standard import library).
Q: Why am I having problems getting information from the
A: Make certain to have 'Allocate Enums as Ints' set
(Options | Compiler | Code Generation in BC 4.x). The
FLDDesc structure, which is used by DbiGetFieldDesc,
contains an enum, which within the DLL is set to the
same size as an int (two bytes).
Q: Why am I having stack corruption problems? or
Why is my application crashing when calling or returning
from a function?
A: First, make certain that you have 25k of stack allocated
for your application. Then, make certain that you have
'Allocate enums as ints' selected. A number of structures,
including CURProps, make use of enumerations. As there
enumerations are allocated two bytes within the DLL, we
need to make certain that the application is passing two
bytes as well. This is done with the 'Allocate enums as
Q: How can I optimize BDE performance on table operations?
A: Although there are a number of ways to improve BDE
performance, some general things to try are as follows:
1) Keep the number of maintained secondary indexes to a
minimum; sometimes it is better to delete the index
and recreate it than to perform a number of table
operations with the indexes in place.
2) If possible, increase the size of the swap buffer
and the number of file handles that the BDE has
available to it. This will decrease the Engine's
need to swap resources. Note: make certain to
increase the file handles available to your
application using SetHandleCount, as well as
increasing the number of file handles available to
the BDE in IDAPI.CFG.
3) Open the table exclusively.
4) Batch as many opperations as possible - do not read/
write records one as a time. Use DbiBatchMove,
DbiCopyTable, DbiReadBlock, and/or DbiWriteBlock.
5) When using DbiWriteBlock, try to work in multiples
of the physical block size, usually 2k or 4k.
6) If you are opening and closing one or more tables
repeatedly, consider calling DbiAcqPersistTableLock
on a non-existent file after you initialize the
BDE. This will create the .LCK file so that it will
not have to be created each time a table is opened,
created, etc. (Note: you'll also want to call
DbiRelPersistTableLock before calling DbiExit).
Paradox Tables Only.
7) Work with in-memory tables when possible (Note that
in-memory tables cannot be the source table to
Q: Is there a version of the BDE for Win32?
A: There currently is not a version of the BDE for 32-bit
Windows. We are commited to a version of the BDE for
Win-32 in the Chicago timeframe.
Q: Can I use the DOS Power Pack with the Borland Database
A: No. The BDE makes use of Windows API functions that are
not emulated by the DOS Power Pack.
Q: Why am I getting the error 'Invalid BLOB Handle in record
Buffer' when I attempt to modify a record containing a
A: This error is caused by not setting up the record
correctly. Make certain to call DbiInitRecord on the
record buffer before reading the record from the table.
Q: Why does my application crash when using filters?
A: Beside the general suggestion at the top of this file, as
well as errors in setting up offsets of the filter, this
error can be caused by setting the iPriority parameter to
DbiAddFiler to 0. Make certain to set this value to 1.
(There is a misprint in some copies of the BDE Users
Guide to set this to 0).
Q: How do I access tables in a read-only directory (such as
a table on a CD-ROM)?
A: A directory lock needs to be placed within the directory
containing the table to prevent the BDE from attempting
to create a lock file (.LCK) in that directory. An
example of this is included in the SNIPIT example
application, in the file RDOLOCK.C.
Q: I got "Table locked/busy" and it's neither?
A: This error happens when the application tries to lock a
table when the corresponding prevent lock already exists,
or when the application tries to set a prevent lock and a
conflicting lock already exists. Check for old, unused
lock files. Delete any .lck files that may exist after all
BDE applications have terminated. Also run the TUtility
program to test for table validity.
Q: Why do I get the error "Multiple Paradox Net Files Found?"
A: In addition to the case of two application referencing
different physical PARADOX.NET files, this error message
can be caused by old .LCK files or when two applications
using the same NET file are mapped differently. Also
make certain that the BDE DLL's are not left in memory.
This error can also occur if differnt mapping are used to
reference the same file. For example, if h:\one\two on
one system points to the same physical location as
h:\three on another system, the BDE will not recognize
that it is only a single .NET file. Make certain that the
Q: I am working with a Peer-to-Peer network, like Windows
for Workgroups, Lantastic, or Personal Netware, and I am
getting "Multiple Paradox Net Files Found", what is wrong?
A: The BDE requires that everyone use the exact same
directory and drive letter. Therefore, if the tables are
on c:\tables on the shared drive and user maps the shared
drive as f: then f:\tables points to the same place as
the shared drive's c:\tables. However, the drive letter
must also match. The way around this is to subst drive
c: as drive f: This way both c: and f: point to the same
drive. Now f:\tables on the shared drive's computer
points to the c:\tables and everyone is using f:\tables.
For more information on the subst command look in your DOS
manual. However, remember that if LASTDRIVE is set to f:
in your CONFIG.SYS then the last drive you can subst is f:
Q: How do I insert a Date into a dBASE table using Local SQL?
A: 'INSERT INTO myTable (myField) value ("01/01/94")'
Q: How can I create a case-insensitive index?
A: Case insensitive indexes are not directly supported, but
can be simulated using an expression index with the upper()
Q: Why can I insert a duplicate record into a dBASE table
when I have a unique index defined?
A: dBASE does not enforce the uniqueness within the table -
only within the index. When the table is opened on that
index, only one record with a given key value will be
present in the index, but both values exist in the table.
Q: Why am I getting the error DBIERR_NOSUCHINDEX, "Index does
not exist", when I attempt to open a FOX table?
A: The BDE does not transparently support FOX (CDX) indexes.
When a FOX table has a CDX index, it is marked as the
production index of that table. The BDE by design has to
open the production index when the table is opened. As it
cannot access the FOX production index (CDX), it returns
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information