- Derby: A Database for All Seasons
- What Is Derby?
- How to Use Derby
- Setting Up Your CLASSPATH
- Testing Your Setup
- Running Your First Derby Program
- Derby Application Components
- Derby Application Startup
- Loading the Derby Driver
- Database and Connection Creation
- Statement Creation
- Table Creation
- Table Access
- Shutdown
- Running the Code
What Is Derby?
Derby is an open source, fully functional relational database management system. It supports many of the features found only in high-end, commercial database engines, such as transactions. Derby itself is written in Java, so it is amenable to the needs of Java programmers. Another important Derby attribute is its really light footprint (about 2MB RAM) that obviates the need for very powerful host machines. Indeed, this light footprint means that we can expect to see Derby programs running on low-end, resource-constrained devices such as PDAs, mobile phones, and so on. This will allow for a whole new generation of sophisticated data-centric applications on such devices.
Derby can comfortably run on a low-end PC and it supports two deployment modes: embedded and network server. In this article, I’ll focus on the embedded option. To be completely accurate, the deployment modes are known as frameworks. The embedded framework is the simplest to use because it features Derby running embedded in a Java application. Much of the associated complexity is then handled by the application because it does the following:
- Loads the JDBC driver
- Starts the Derby engine
- shuts down the Derby engine when the application exits
A limitation of the embedded framework is that only a single application can access the Derby database at any one time. However, for low-end applications, the embedded framework is likely to suit just fine. The server framework, on the other hand, differs because it provides a continuously running server-style Java application that allows multiple, remote JDBC applications to connect to Derby.
Originally, Derby emerged from an IBM database product called Cloudscape and has since been open sourced by IBM.