Table of Contents
This book has until now been an introduction on how to use the BDB XML API to add a native XML database to your application. But having written that application, there's some administrative concerns that you should keep in mind as your application moves into production. These concerns are described in this chapter.
All Berkeley DB XML applications are capable of writing temporary files to disk. This happens when the disk cache fills up and so BDB XML is forced to write overflow pages. For the most part, these temporary files can be safely ignored.
However, for some class of applications, the presence
of the temporary overflow files can be problematic.
You can prevent temporary files from being created on your hard drive
by creating your disk cache large enough that it can contain your entire working
set of data. You do this
using the
DB_ENV->set_cachesize()
method prior to opening your environment.
It is always safe to delete temporary overflow files written by BDB XML after the application has shutdown.
Temporary database files are placed in the directory identified by
the
DB_ENV->set_temp_dir()
method. If this method is not called by the application, then the
application will use the directory identified on an environment
variable, if your application is configured to do this. Assuming that it
is appropriately configured, then the following environment variables
are checked to see if they have been set. The following
order of precedence matters; the first of the following environment
variables found to be set is used to determine the location of the
temporary directory:
TMPDIR
TEMP
TMP
TempFolder
TMPDIR
If none of these environment variables are set, BDB XML checks the value
returned by the GetTempPath
interface to see if
that is set. If not, then the default location identified above are
attempted.
Environment variables are not used by BDB XML applications
unless
the DB_USE_ENVIRON
or
DB_USE_ENVIRON_ROOT
flags are set
when the environment is opened.
If no other method of determining the location of the temporary file directory can be found, then BDB XML will resort to using built-in default values. That is, the first of the following locations found to exist is used, if a temporary file directory is not otherwise identified for BDB XML:
The directory /var/tmp
The directory /usr/tmp
The directory /temp
The directory /tmp
The directory C:/temp
The directory C:/tmp