This event processing example shows how Oracle Berkeley DB can be used to implement location based personal advertising using smart phones.  It consists of three parts.

Data Generator - Creates two Berkeley DB databases and populates them with data.  One database is a SQL database that contains information on the stores advertised, including their location and the ads to send.=.  The other database is a btree database that contains the shopping preferences of the phone owners.

Event Generator - Simulates GPS coordinates sent by the smart phone to a central server.

Personal Advertising Server - Receives the GPS coordinates from the phones.  First looks up the shopping preferences of the phone owner in a Berkeley DB database, then uses that information plus the GPS coordinates to find ads for nearby stores in the SQL database.

BUILD AND RUN

Windows

To build first install Oracle Berkeley DB 6.1 and update the INCLUDE, LIB, and PATH environment variables to point to the include, lib, and bin directories in the install path.  Next change to the BDBAdvertisingExample directory and open BDBAdvertisingExample.sln with Visual Studio.  For each project, DataGenerator, EventGenerator, and PersonalAdvertising, right click the project and select Properties->Configuration Properties->VC++ Directories.  Update Executable Directories, Include Directories, and Library Directories to include the path to the Berkeley DB install directory.  Then select Build Solution from the Build menu.  

To run the example click or run the file RunAdvertisingExample.bat.

Unix/Linux

To build first install Oracle Berkeley DB and add compiler options that point to the installed include directory to the environment variable CFLAG, and linker options that point to the installed lib directory to LDFLAGS.  Next change to the BDBAdvertisingExample directory and enter the following commands:
./configure
make

To run execute the script RunAdvertisingExample.sh.