Introduction

This guide presents step-by-step instructions for installing the ODB system on Windows to be used with Microsoft Visual Studio. If you would like to use ODB with GCC on MinGW/MinGW64 (either directly as past of an IDE such as Qt Creator), refer to Installing ODB on MinGW.

Before you can start using ODB in your applications, you will need to install three essential packages: the ODB compiler (odb), the common runtime library (libodb), and the database-specific runtime library (libodb-<database>). The database runtime library is specific to the database system you are planning to use. For example, if you are going to use MySQL, then the database runtime will be libodb-mysql. If you would like to use several database systems, install the corresponding runtime libraries for each of them.

You may also choose to install optional ODB packages such as ODB profile libraries, the ODB examples (odb-examples) and the test suite (odb-tests). You only need to install a profile library if you are planning to use the corresponding profile in your application. Similarly, you only need the examples and test suite if you are interested in building the examples or running the tests.

Prerequisites

In order to build ODB source packages you will need Microsoft Visual Studio 2008 (VC++ 9.0) or later. You will also most likely need a client library for the database system of your choice. For example, for MySQL you need the libmysqlclient library. The INSTALL file accompanying each database runtime library has more information on the database-specific prerequisites.

Installing the ODB Compiler

To install the ODB compiler, download the pre-compiled binary package for Windows and unpack it into a directory of your choice, for example C:\tools. The ODB compiler binary will be in the bin\ directory inside the package directory, for example C:\tools\odb-x.y.z-i686-windows\bin\. You can run the ODB compiler by either using the absolute path, for example:

C:\tools\odb-x.y.z-i686-windows\bin\odb --version
  

Or you can add the bin\ directory to the Path environment variable. To accomplish this, open Control Panel, then System, select the Advanced tab and click on the Environment Variables button. If you have administrator privileges, select the Path variable from the System variables list. Otherwise, select (or create) the Path variable from the User variables list. Click the Edit button and add the bin\ directory to the list. Click Ok, then log off and log on again for the changes to take effect. Once this is done, you should be able to run the ODB compiler by using just its name, for example:

odb --version
  

Note that building the ODB examples and the test suite requires that the ODB compiler bin\ directory be in the Path environment variable (or, alternatively, in the Executable Files list in the VC++ Directories).

Note also that while you can move the ODB compiler directory around, you cannot move individual sub-directories or files inside it. For example, copying the ODB compiler executable to C:\Windows will not work.

Building the ODB compiler from source code on Windows involves a custom build procedure. If you absolutely must build the ODB compiler yourself, write to the odb-users@codesynthesis.com mailing list for more information.

Installing the Common Runtime Library

To install the common runtime library, download the libodb source package and use the provided solution file corresponding to your version of Visual Studio. Refer to the INSTALL file in the libodb package for information on how to configure Visual Studio to automatically locate the libodb headers, DLLs, and import libraries.

Installing the Database Runtime Library

To install the common runtime library, download the libodb-<database> source package and use the provided solution file corresponding to your version of Visual Studio. Refer to the INSTALL file in the libodb-<database> package for information on database-specific prerequisites and how to configure Visual Studio to automatically locate the libodb-<database> headers, DLLs, and import libraries.

Installing Profile Libraries

If you would like to install a profile library, download the corresponding source package (libodb-<profile>) and use the provided solution file corresponding to your version of Visual Studio. Refer to the INSTALL file in the libodb-<profile> package for information on profile-specific prerequisites and how to configure Visual Studio to automatically locate the libodb-<profile> headers, DLLs, and import libraries.

Building and Running the Examples

If you would like to build and run the ODB examples, download the odb-examples package and use the provided solution files. While you can run each example individually, the package also includes a batch file that runs all of the examples automatically. Refer to the accompanying INSTALL file for more detailed information on how to build and run the examples.

Building and Running the Tests

If you would like to build and run the ODB test suite, download the odb-tests package and use the provided solution files. The package also provides batch files that allow you to build and run the tests automatically in non-interactive mode. Refer to the accompanying INSTALL file for more detailed information on how to build and run the test suite.