Berkeley DB XML Reference Guide:
Building Berkeley DB XML for Windows systems

PrevRefNext

Building Berkeley DB XML for Windows

If you are working with the source release of Berkeley DB XML, follow the build instructions below.

Building Berkeley DB XML

The build_windows directory in the Berkeley DB XML source distribution contains project files, workspace files, and solution files for Microsoft Visual Studio versions 6, 7.1, and 8.0. These correspond to Visual C++ 6, Microsoft Visual Studio .NET 2003, and Visual Studio 2005 respectively. The files are:

BDBXML_all.sln
MSVC7.1 solution file, including projects for all third-party libraries, and Berkeley DB XML examples
BDBXML_all_vs8.sln
A Visual Studio version 8.00 solution file (for Visual Studio 2005 and later), including projects for all third-party libraries, and Berkeley DB XML examples
BDBXML_all.dsw
MSVC6.0 workspace file, including projects for all third-party libraries, and Berkeley DB XML examples
*.vcproj
MSVC7.1 and 8.0 project files
*.dsp
MSVC6.0 projects

These project files can be used to build Berkeley DB XML for any Windows platform: Windows/XP, Windows/2000, Windows/NT and Windows/98.

Berkeley DB XML makes use of several third-party libraries. Each of these packages is freely available and distributed under an Open Source license. The Berkeley DB XML distribution includes compatible versions of all third-party libraries. No additional downloads are required. Use of other versions may not work, and may not be supported. Berkeley DB XML requires the following third-party libraries:

Berkeley DB
Berkeley DB is a general purpose database toolkit. This release of Berkeley DB XML includes the Berkeley DB 4.6.21 release, and requires the Berkeley DB 4.3.28 release or later.
Xerces
Xerces is the Apache implementation of XML parsing technology and DOM. The build requires a source release of Xerces, not just a binary release. This release of Berkeley DB XML bundles Xerces-C 2.8.0, and requires the Xerces 2.7.0 release or newer.
XQilla
XQilla is an open source implementation of XQuery 1.0 and XPath 2.0. Berkeley DB XML bundles a specific public release of XQilla which must be used. Later versions of XQilla may work, but are not implicitly supported.

These instructions use a Berkeley DB XML release number of 2.4.11. If that is not your release, adjust your paths accordingly.

Building with Microsoft Visual Studio .NET 2003

  1. Choose File -> Open Solution. Look in the dbxml-2.4.11/dbxml/build_windows directory for solution files, select BDBXML_all.sln, and press Open.

  2. Choose the project configuration from the drop-down menu on the .NET tool bar.

  3. To build, select Build Solution from the Build drop-down menu. All library files (*.lib) are placed in dbxml-2.4.11/lib, DLLs and executables are installed in dbxml-2.4.11/bin or dbxml-2.4.11/bin/debug depending on the configuration you choose, .jar files are placed in dbxml-2.4.11/jar, and header (include) files for application development are copied to dbxml-2.4.11/include.

  4. By default, BDBXML_all.sln builds all third-party libraries, Berkeley DB XML, and Berkeley DB XML C++ examples. The examples are installed in bin{/debug} along with other executables.

Building with Microsoft Visual Studio 2005

  1. Choose File -> Open -> Project/Solution. Look in the dbxml-2.4.11/dbxml/build_windows directory for solution files, select BDBXML_all_vs8.sln, and press Open. This will put you into the Visual Studio Conversion Wizard

  2. Choose Next, and then choose to either create a backup before conversion or not (creating a backup is recommended). Choose Next again, then Finish. All project files will be converted to the Visual Studio 2005 format. Although the solution and most project files are created for Visual Studio version 8.00 and later some conversions are still necessary.

  3. Choose the project configuration from the drop-down menu on the Visual Studio tool bar.

  4. To build, select Build Solution from the Build drop-down menu. All library files (*.lib) are placed in dbxml-2.4.11/lib, DLLs and executables are installed in dbxml-2.4.11/bin or dbxml-2.4.11/bin/debug depending on the configuration you choose, .jar files are placed in dbxml-2.4.11/jar, and header (include) files for application development are copied to dbxml-2.4.11/include.

    There are likely to be a number of warnings related to "deprecated" interfaces in the Microsoft C runtime. The warning number is 4996, and may mention using "_CRT_SECURE_NO_DEPRECATE." These warnings are expected, and harmless. If you would like to quiet them down, you can add "_CRT_SECURE_NO_DEPRECATE=1" to the preprocessor configuration for each project.

  5. By default, BDBXML_all_vs8.sln builds all third-party libraries, Berkeley DB XML, and Berkeley DB XML C++ examples. The examples are installed in bin{/debug} along with other executables.

Building with Microsoft Visual C++ 2005 Express Edition

  1. Download and install Microsoft Platform SDK.

  2. Choose File -> Open -> Project/Solution. Look in the dbxml-2.4.11/dbxml/build_windows directory for solution files, select BDBXML_all_vs8.sln, and press Open. This will put you into the Visual Studio Conversion Wizard

  3. Choose Next, and then choose to either create a backup before conversion or not (creating a backup is recommended). Choose Next again, then Finish. All project files will be converted to the Visual Studio 2005 format.

  4. Right click the db_dll project and select properties. On the properties page select All Configurations from the Configuration menu in the top left corner. Enter ws2_32.lib advapi32.lib for the Additional Dependencies option of Linker -> Input. Select the OK button to save the changes.

  5. Select Options... from the Tools pull-down menu. Choose Projects and Solutions, then VC++ Directories. Select Include files from the Show directories for menu. Add the complete path to Microsoft Platform SDK\Include\mfc and Microsoft Platform SDK\Include to the list of directories. Next select Library files from the Show directories for: menu. Add the complete path too Microsoft Platform SDK\Lib to the list of directories.

  6. Choose the project configuration from the drop-down menu on the Visual Studio tool bar.

  7. To build, select Build Solution from the Build drop-down menu. All library files (*.lib) are placed in dbxml-2.4.11/lib, DLLs and executables are installed in dbxml-2.4.11/bin or dbxml-2.4.11/bin/debug depending on the configuration you choose, .jar files are placed in dbxml-2.4.11/jar, and header (include) files for application development are copied to dbxml-2.4.11/include.

    There are likely to be a number of warnings related to "deprecated" interfaces in the Microsoft C runtime. The warning number is 4996, and may mention using "_CRT_SECURE_NO_DEPRECATE." These warnings are expected, and harmless. If you would like to quiet them down, you can add "_CRT_SECURE_NO_DEPRECATE=1" to the preprocessor configuration for each project.

  8. By default, BDBXML_all_vs8.sln builds all third-party libraries, Berkeley DB XML, and Berkeley DB XML C++ examples. The examples are installed in bin{/debug} along with other executables.

Building with Microsoft Visual Studio 2008 and Visual C++ 2008 Express Edition

  1. Download and install Microsoft Platform SDK.

  2. Follow the instructions above for Visual C++ 2005 Express Edition for opening a solution file and converting projects.

  3. built one at a time. Also be sure to explicitly set the configuration to Debug or Release depending on the build desired.

  4. The conversion process may result in modifying the project configuration, dependencies and build order, so if using this compiler it is best to build the various projects one at a time in this order:

    At this point the order does not matter but the projects should still be built one at a time.

  5. Because the projects are built one at a time the Berkeley DB utilities (db_*) will not automatically be copied to the installation directory -- bin or bin/debug. They must be copied explicitly from the Berkeley DB build_windows directory.

Building with Microsoft Visual C++ 6.0

  1. Choose File -> Open Workspace. Look in the dbxml-2.4.11/dbxml/build_windows directory for Workspaces, select BDBXML_all.dsw, and press Open.

  2. Choose the desired project configuration by going to Build -> Set Active Configuration and select the appropriate option to the all project. Then click OK.

  3. To build, select Build -> Build all.exe. All library files (*.lib) are placed in dbxml-2.4.11/lib, DLLs and executables are installed in dbxml-2.4.11/bin or dbxml-2.4.11/bin/debug depending on the configuration you choose, .jar files are placed in dbxml-2.4.11/jar, and header (include) files for application development are copied to dbxml-2.4.11/include.

  4. By default, BDBXML_all.dsw builds all third-party libraries, Berkeley DB XML, and Berkeley DB XML C++ examples. The examples are installed in bin{/debug} along with other executables.

When building your application, you should normally use compile options "Debug Multithreaded DLL" and link against lib/libdbxml24d.lib. You can also build using a release version of the libraries and tools, which will be placed in lib/libdbxml24.lib. A safe way to construct a project file for your application is to adapt one of the Berkeley DB XML example projects.

Building on Cygwin

To build Berkeley DB XML on Cygwin follow the instructions at Building Berkeley DB XML for UNIX/POSIX.

Running C++ Examples

After a successful build, the Berkeley DB XML example executable files are in bin{/debug}. See dbxml/examples/cxx/gettingStarted/Readme.txt for instructions on building the C++ example containers and running examples.

Building the Java API with Visual Studio .NET 2003

The Berkeley DB XML Java API is not built automatically. The following instructions assume that you have installed the Sun Java Development Kit in d:/java. Of course, if you installed elsewhere or have different Java software, you will need to adjust the pathnames accordingly.

  1. Set your include directories. Choose Tools -> Options -> Projects -> VC++ Directories. Under the "Show directories for" pull-down, select "Include files". Add the full pathnames for the java/include and java/include/win32 directories. Then click OK. These are the directories needed when including jni.h.

  2. Set the executable files directories. Choose Tools -> Options -> Projects -> VC++ Directories. Under the "Show directories for" pull-down, select "Executable files". Add the full pathname for the java/bin directory, then click OK. This is the directory needed to find javac.

  3. Set the build type to Release or Debug (or other appropriate configuration) in the drop-down on the .NET tool bar.

  4. Right-click on db_java and select Build. This builds the Java support library for Berkeley DB, which is required for Berkeley DB XML, and compiles all the java files, placing the resulting db.jar and dbexamples.jar files in bin or bin/debug.

  5. Right-click on dbxml_java and select Build. This builds the Java support library for Berkeley DB XML and compiles all the java files, placing the resulting dbxml.jar and dbxmlexamples.jar files in jar.

Building Java with Visual C++ 6.0

  1. Set the include directories. Choose Tools -> Options -> Directories. Under the "Show directories for" pull-down, select "Include files". Add the full pathnames for the java/include and java/include/win32 directories. These are the directories needed when including jni.h.

  2. Set the executable files directories. Choose Tools -> Options -> Directories. Under the "Show directories for" pull-down, select "Executable files". Add the full pathname for the java/bin directory. This is the directory needed to find javac.

  3. Go to Build -> Set Active Configuration and select either the Debug or Release version of the db_java project. Then press OK.

  4. Select Build -> Build libdb_java46.dll. This builds the Java support library for Berkeley DB, which is required for Berkeley DB XML, and compiles all the java files, placing the resulting db.jar and dbexamples.jar files in jar.

  5. Go to Build -> Set Active Configuration and select either the Debug or Release version of the dbxml_java project. Then press OK.

  6. Select Build -> Build libdbxml_java24.dll. This builds the Java support library for Berkeley DB XML, and compiles all the java files, placing the resulting dbxml.jar and dbxmlexamples.jar files in jar.

To run Java code, set your environment variable CLASSPATH to include the full pathname of these jar files, and your environment variable PATH to include the bin (Release build) or bin/debug (Debug build) subdirectory. The jar files for debug and release builds are identical, and will attempt to load the approriate native libraries, first attempting to load Release, then Debug libraries. On Windows, remember that files or directories in the CLASSPATH and PATH variables must be separated by semicolons (unlike UNIX)

Building and Running the Java API on Cygwin

Some files must be edited before the Java API can be built on Cygwin.

Edit file db-<version>/dist/configure and change line:

CLASSPATH=".:$CLASSPATH"