The easiest way to get started is to download the Express-C versions of DB2 for Windows or Linux, then run the spatial demo program to create a number of tables containing spatial data. The geobrowser can be downloaded to view the data in these tables and the results of spatial queries. See the Resources section for the code.
The DB2 Information Center includes a section for "Spatial data," which provides information about installing and working with DB2 Spatial Extender (see Resources).
After downloading and unpacking the install images, run the setup.exe (Windows) or db2setup (Linux) for the DB2 server. The custom option in the setup process should be used to select the Spatial Extender server and client components.
In the Windows environment, it is necessary to increase the database manager configuration parameter for the agent stack size with the following commands issued from a DB2 command window:
db2 update dbm cfg using agent_stack_sz 100 db2stop db2start
In Linux, it is necessary to set the DB2PATH environment variable to point to the DB2 instance installation directory prior to running the spatial demo program with a command like:
If your DB2 instance is different, modify the command to point to the correct location.
Before running the spatial demo program, you need to create a
database. The easiest way to do this is to create the default DB2
sample database with the command
then change to the spatial samples directory:
cd /home/db2inst1/sqllib/extenders/samples/spatial (Linux) or cd c:\program files\IBM\sqllib\extenders\samples\spatial (Windows)
and run the command
runGseDemo sample userid
will enable the database for spatial processing, create a number of
spatial tables, and execute spatial queries with output to
the terminal window.
The geobrowser is simply installed by unzipping the downloaded file to a convenient location on your system. The batch files to start the geobrowser — run_geobrowser.cmd (Windows) and run_geobrowser.sh (Linux) — may need to be modified according to information in the batch file to set the Java™ classpath appropriately.