# Scores Demo

The `DERBY_HOME/demo/programs/scores` directory contains a demo application which shows how you can run user-written Java code inside the Derby database.

To see the Ant targets that enable you to build and run the demo application, cd to this directory and type the following command:

       ant -projecthelp

Follow the instructions in the command output. You may need to download the Jakarta Commons Math library from the Apache web site. After customizing a property, you will use the `ant run` command to run the application.

The demo shows you how to do the following:

- Declare Java functions and procedures and run them inside the Derby engine
- Load the Derby engine with jar files of user-written code
- Enforce data consistency by wiring functions into CREATE TABLE statements
- Run a Java procedure from a TRIGGER
- Improve query performance by wiring filtering functions into the WHERE clause
- Format query output by wiring functions into the SELECT list
- Re-use off-the-shelf packages to write your own custom data aggregator

For more detail, please consult the following sections of the Derby Developer's Guide:

- "Loading classes from a database"
- "Derby server-side programming"

Last updated for Apache Derby Version 10.11