Example Programs

# Example Apache Derby Programs

In this distribution of Apache Derby, the directory demo/programs/ contains example databases and programs written in Java. Some of the sample programs are used as references in some of the Derby user manuals, see Getting Started with Apache Derby and the Apache Derby Server and Administration Guide. Other programs are simply demonstrations of how to get started using Derby, or how to utilize certain features.

- Simple

  A very simple JDBC application that boots the driver, creates a database, and loads some data. This application can run in both embedded and client/server settings.

- Simple Mobile Demo

  A simple JDBC application for Java ME (J2ME) environments. This demo application uses Derby's EmbeddedSimpleDataSource to create a database and insert, modify and retreive some data.

- Network Server Sample Programs

  Two examples are provided to demonstrate how to obtain an embedded connection and client connections using the Network Server to connect to the same database. An embedded connection is a connection to a database that is booted in the same JVM as the application. Client applications that require a database connection across the network use the network server protocol (DRDA) to connect to the Network Server. This type of connection is referred to as a client connection.

- ToursDB sample database schema

  The toursdb is provided as an example and demo database to illustrate some functionality of the Derby RDBMS. Many of the examples in the Derby documentation use tables that exist in the toursdb database. The document describes the tables, the names and types of columns in those tables, and the constraints, indexes, and triggers in the database.

- Getting Started With Derby

  Programs described and modified as part of the activities documented in the Getting Started With Derby manual.

- LocalCalendar

  The LocalCalendar application demonstrates the embedded/offline capabilities of Derby through a sample application that lets you manage GoogleCalendar events offline and synchronize when you come back online.

- Scores

  From Apachecon 2006 (Austin), this demo shows how to use user-coded Java functions and procedures inside the Derby engine.

- VTIs

  This set of demos contains sample table functions for

  - making a table out of a property file
  - making a table out of an XML file
  - making tables out of subversion logs, apache web server logs, and JIRA reports.

  In addition, this demo provides machinery for declaring and refreshing paramaterized subscriptions to data from foreign SQL databases.