Java DB

Apache Derby

Derby Developer's Guide

Derby Getting Started
Derby Reference Manual
Derby Developer's Guide
Derby Performance Tuning
Derby Server and Admin Guide
Derby Tools and Utilities
Derby Developer's Guide
-After installing
-Upgrades
-JDBC applications and Derby basics
-Application development overview
-Derby embedded basics
-Derby JDBC driver
-Derby JDBC database connection URL
-Derby system
-A Derby database
-Connecting to databases
-Working with the database connection URL attributes
-Using in-memory databases
-Working with Derby properties
-Deploying Derby applications
-Deployment issues
-Creating Derby databases for read-only use
-Loading classes from a database
-Derby server-side programming
-Programming database-side JDBC routines
-Programming trigger actions
-Programming Derby-style table functions
-Programming user-defined types
-Controlling Derby application behavior
-The JDBC connection and transaction model
-Result set and cursor mechanisms
-Locking, concurrency, and isolation
-Working with multiple connections to a single database
-Working with multiple threads sharing a single connection
-Working with database threads in an embedded environment
-Working with Derby SQLExceptions in an application
-Using Derby as a J2EE resource manager
-Derby and Security
-Configuring security for your environment
-Working with user authentication
-Users and authorization identifiers
-User authorizations
-Encrypting databases on disk
-Signed jar files
-Notes on the Derby security features
-User authentication and authorization examples
-Running Derby under a security manager
-Developing tools and using Derby with an IDE
-SQL tips
-Localizing Derby
-Derby and standards

 

The database directory

A Derby database is stored in files that live in a directory of the same name as the database. Database directories typically live in system directories.

Note: An in-memory database does not use the file system, but the size limits listed in the table Size limits for Derby database objects still apply. For some limits, the maximum value is determined by the available main memory instead of the available disk space and file system limitations.

A database directory contains the following, as shown in the following figure.

  • log directory

    Contains files that make up the database transaction log, used internally for data recovery (not the same thing as the error log).

  • seg0 directory

    Contains one file for each user table, system table, and index (known as conglomerates).

  • service.properties file

    A text file with internal configuration information.

  • tmp directory

    (might not exist.) A temporary directory used by Derby for large sorts and deferred updates and deletes. Sorts are used by a variety of SQL statements. For databases on read-only media, you might need to set a property to change the location of this directory. See "Creating Derby Databases for Read-Only Use".

  • jar directory

    (might not exist.) A directory in which jar files are stored when you use database class loading.

Read-only database directories can be archived (and compressed, if desired) into jar or zip files. For more information, see Accessing a read-only database in a zip/jar file.

The following figure shows the files and directories in the Derby database directories that are used by the Derby software.

Figure 1. An example of a Derby database directory and file structure.
This figure shows the files
and directories that might be found in the main directory of a Derby database
called Sales: the service.properties file, and the log, seg0, tmp, and jar
directories.

Derby imposes relatively few limitations on the number and size of databases and database objects. The following table shows some size limitations of Derby databases and database objects:

Table 1. Size limits for Derby database objects
Type of Object Limit
tables in each database java.lang.Long.MAX_VALUE

Some operating systems impose a limit to the number of files allowed in a single directory.

indexes in each table 32,767 or storage
columns in each table 1,012
number of columns on an index key 16
rows in each table No limit.
size of table No limit. Some operating systems impose a limit on the size of a single file.
size of row No limit. Rows can span pages. Rows cannot span tables so some operating systems impose a limit on the size of a single file, which results in limiting the size of a table and size of a row in that table.

For a complete list of restrictions on Derby databases and database objects, see the Derby Reference Manual.

 

javadb@jdbcurl.com