Table Functions Demo

The DERBY_HOME/demo/programs/vtis directory contains sample table functions.

This code is now built as part of the standard Derby build. To build the API documentation, invoke the demodocs target in the top-level build script.

An .sql script, sql/demoFileVtis.sql, is provided to test-drive these table functions. Use Derby's ij tool to run this script. The script needs to be customized as explained in its header.

This script exercises the following table functions:

How to run this sample application in an embedded environment

This demo relies on the Derby embedded JDBC driver and the interactive ij tool (used for issuing SQL):

Class name: org.apache.derby.jdbc.EmbeddedDriver
Library: derby.jar

 

Class name: org.apache.derby.tools.ij
Library: derbytools.jar

 

  1. Open a command window.
  2. If you haven't set it already on a system-wide basis, set the DERBY_HOME environment variable to the location of this Derby installation. This is not strictly required to run the demo, but this environment variable will be used later on this page to refer to the required Derby resources, files, etc. Examples:

    UNIX (ksh/bash)

    export DERBY_HOME=/home/user/derby/db-derby-10.x.y.z-bin

    Windows:

    set DERBY_HOME=c:\programs\derby\db-derby-10.x.y.z-bin

  3. Change directory to the $DERBY_HOME/demo/programs/vtis directory.
  4. In the command window, set the CLASSPATH to include the current directory (the location of demoFileVtis.sql), Derby's embedded driver library (derby.jar), and Derby's tool library (derbytools.jar). (You may skip this step and provide the classpath as an option to the JVM launch command instead, refer to your JVM's documentation for details).

    This may be done as follows:

    UNIX (ksh/bash):

    export CLASSPATH=.:${DERBY_HOME}/lib/derby.jar:${DERBY_HOME}/lib/derbytools.jar

    WINDOWS:

    set CLASSPATH=.;%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbytools.jar

  5. Once you have your environment set up correctly, execute the demo from the same directory (demo/programs/vtis):

    java org.apache.derby.tools.ij demoFileVtis.sql

    A successful run produces many pages of SQL commands and query results.

    If any error messages appear, and you are unable to resolve the error(s), ask for help on the derby-user mailing list.