Apache Derby
Apache Derby is an open-source relational database management system (RDBMS) implemented entirely in the Java programming language.[1] It is licensed under the Apache License, Version 2.0, and serves as a subproject of the Apache DB project within the Apache Software Foundation.[2] Derby is designed for ease of use and deployment, featuring a small footprint of approximately 3.5 MB for its base engine and embedded JDBC driver, making it particularly suitable for embedding directly into Java applications.[1] Derby supports both embedded and client/server modes, with the embedded JDBC driver allowing seamless integration into Java solutions and the Network Server enabling TCP/IP connections via the DRDA protocol for JDBC, ODBC/CLI, Perl, and PHP clients.[2] It is based on Java, JDBC, and SQL standards, providing compliance with JDBC 4.0 and partial support for ANSI/ISO SQL features, including transaction control, savepoints, and isolation levels.[1][3] Additional utilities include ij for running SQL scripts, dblook for schema extraction, and sysinfo for version details.[2] However, on October 10, 2025, the Derby developers voted to retire the project into a read-only state, ending further development and bug fixes, with the website, wiki, and issue tracker now archived.[4] The last stable release was version 10.17.1.0 (November 2023).[4]Overview
Description and key characteristics
Apache Derby is an open-source relational database management system (RDBMS) implemented entirely in the Java programming language.[1] It serves as a lightweight, standards-based database engine designed for seamless integration into Java applications, offering both embedded and networked deployment options under the Apache License, Version 2.0.[1] Key characteristics of Apache Derby include its exceptionally small disk footprint of approximately 3.5 megabytes for the base engine and embedded JDBC driver, making it suitable for resource-constrained environments.[1] As a pure Java implementation, it achieves platform independence by running on any Java Virtual Machine (JVM), ensuring portability across operating systems without requiring native code compilation.[5] Derby supports two primary modes of operation: an embedded mode where the database runs within the same JVM as the application for tight coupling and low overhead, and a client/server mode that enables remote access via a network server.[1] Derby adheres to core SQL standards, providing partial compliance with SQL-92 Entry Level and extensions supporting features from SQL:2011, such as basic data types, queries, joins, and transactions.[6] It fully complies with JDBC 4.0 and later versions (up to 4.2), allowing standard Java database connectivity. For networked operations, Derby utilizes the Distributed Relational Database Architecture (DRDA) protocol over TCP/IP to handle client connections.[7] Compared to traditional RDBMS like Oracle or MySQL, Derby positions itself as a simpler, lighter-weight alternative optimized for ease of integration and development rather than extreme scalability in high-volume enterprise scenarios.[8]Licensing and current status
Apache Derby is distributed under the Apache License 2.0, a permissive open-source license that permits free use, modification, and distribution of the software, provided that the copyright notice and disclaimer are retained in all copies.[9] This licensing model has facilitated its integration into various Java-based applications and proprietary projects without restrictive requirements.[1] As a subproject of the Apache DB project, Derby operated under the governance of the Apache Software Foundation, with development driven by a community of contributors through consensus-based decision-making until the project's cessation.[10] The Apache DB Project Management Committee (PMC) oversaw strategic direction, ensuring adherence to Apache's meritocratic processes for code contributions, releases, and issue resolution.[11] The most recent stable release, version 10.17.1.0, was announced on November 14, 2023, introducing support for Java SE 21 while maintaining compatibility with earlier Java versions.[12] On October 10, 2025, the Derby community voted to retire the project into a read-only state, halting all further development, bug fixes, and new releases.[13] Following retirement, key resources including the project website, wiki, JIRA issue tracker, and mailing lists have been archived or disabled, with no new interactions possible.[4] This retirement implies that while existing Derby deployments remain fully usable and downloads are available on an as-is basis, there is no ongoing support, security updates, or enhancements.[4]History
Origins as Cloudscape
Cloudscape Inc. was established in 1996 in Oakland, California, by former Sybase engineers Nat Wyatt and Howard Torf, with the goal of developing database technology based on the emerging Java programming language.[14] The company focused on creating lightweight, embeddable relational database solutions tailored for Java applications, addressing the need for portable and efficient data management in distributed environments.[15] Early development efforts resulted in the release of the company's first product, JBMS 1.0 (Java Backend Management System), in 1997, which provided a foundational Java-based relational database engine for application deployment.[15] This was followed by Cloudscape 2.0 in April 1999, which enhanced SQL capabilities, including support for JDBC 2.0 and ODBC 3.0, enabling more robust data access and integration in Java ecosystems.[15][16] In October 1999, Cloudscape Inc. was acquired by Informix Software for approximately $85 million in stock, integrating its technology into Informix's portfolio of database solutions.[15][17] When IBM acquired Informix's database assets in July 2001 for $1 billion, Cloudscape became part of IBM, where it was rebranded as IBM Cloudscape.[2][18] Under IBM, Cloudscape was primarily positioned as an embeddable, pure-Java relational database engine, emphasizing its small footprint and ease of integration for Java-based applications.[19] It was incorporated into IBM products such as WebSphere Application Server, where it served as a lightweight data store for development and testing, and used extensively internally at IBM to meet embedded database requirements in enterprise Java environments.[19]Transition to Apache Derby and later developments
In August 2004, IBM contributed the source code of its Cloudscape database to the Apache Software Foundation as an incubator project under the Apache DB umbrella, renaming it Derby to reflect its new open-source identity. This move aimed to foster community-driven development while preserving the technology's core strengths in Java-based relational database management. The contribution included a snapshot of Cloudscape version 10.0, enabling immediate availability for open-source collaboration.[2][20] The Derby project rapidly matured within the incubator, releasing its first version, 10.0.2.1, in December 2004. By July 2005, it graduated to become a subproject of the top-level Apache DB project, marking a significant milestone in its transition to full Apache governance. The first post-graduation release, 10.1.1.0, arrived in August 2005, introducing enhancements such as a new network client driver, online database compression, XA transaction support, and longer identifier lengths to improve usability in distributed environments.[21][22] Subsequent years saw steady evolution through major version releases that expanded Derby's capabilities and standards compliance. Version 10.5, released in 2009, bolstered JDBC support with features like in-memory database mode for faster prototyping and testing, alongside refinements to the embedded engine. In 2013, version 10.10 advanced SQL conformance by incorporating elements aligned with SQL:2011, including improved query handling and procedural extensions. By 2017, version 10.14 delivered key performance optimizations, such as faster query compilation, reduced memory usage, and better integration with Java 8's JDBC 4.2 enhancements. The project continued with releases up to 10.17.1.0 in November 2023, focusing on stability, bug fixes, and compatibility with modern Java versions.[23][24][25][26] In parallel, adoption grew through strategic integrations; in 2006, Sun Microsystems (acquired by Oracle in 2010) began bundling a supported distribution of Derby, known as Java DB, with Java SE 6, embedding it directly in the JDK for seamless use in Java applications. This boosted visibility and reliability for developers. The open-source community thrived with ongoing contributions from IBM engineers, Oracle participants, and independent developers, emphasizing Derby's role in embedded scenarios like mobile applications and network appliances where its lightweight footprint—around 3.5 MB for the core engine and JDBC driver—proved ideal.[27][2][20] On October 10, 2025, the Derby developers voted to retire the project into a read-only state, ending further development and bug fixes.[4]Architecture
Core components
Apache Derby employs a modular architecture designed to separate concerns across distinct layers, enabling efficient implementation of relational database management system (RDBMS) functionality in pure Java. The overall structure consists of four primary code areas—JDBC, SQL, Store, and Services—that interact to process queries, manage data persistence, and provide connectivity, with modules using Java interfaces to allow pluggable implementations for system-wide or database-specific services.[28] The Derby Engine forms the core RDBMS component, handling SQL query parsing, optimization, and execution through a structured compilation process. This process includes five steps: parsing via a Javacc-generated parser to build query node trees, binding to resolve identifiers and data types, optimization to determine efficient access paths, code generation into executable Java classes, and loading of those classes for runtime use. Execution occurs via these generated classes, which produce Derby-specific ResultSet objects subsequently presented to applications as standard JDBC ResultSets, with just-in-time (JIT) compilation enhancing performance for iterative queries.[28] The Store layer oversees physical data management, encompassing disk input/output, logging for crash recovery, and transaction coordination. Divided into access and raw sub-layers, the access component conducts table and index scans, applies locking for concurrency, and manages transactions, while the raw component handles page-level storage, transaction logging, pluggable file systems, and optional Java Cryptography Extension (JCE) encryption. Derby utilizes row- and table-level locking for concurrency control, supporting four SQL-standard isolation levels—Read Uncommitted, Read Committed (the default), Repeatable Read, and Serializable—to mitigate issues like dirty reads, non-repeatable reads, and phantom reads. For distributed scenarios, transaction management incorporates two-phase commit protocols through XADataSource and related javax.sql interfaces.[28][29][30] The JDBC layer implements the java.sql and javax.sql interfaces, serving as the exclusive application-facing API for database connectivity and operations. It encapsulates all external interactions, forwarding SQL requests to the underlying SQL layer while abstracting the engine's internal mechanics from Java applications.[28] Derby accommodates essential relational data structures such as tables, indexes, views, and constraints, all persisted and manipulated via the Store layer's mechanisms. The Services layer provides foundational utilities, including a monitor for module dispatching, lock management (e.g., via clock/ring algorithms), and caching for objects like statement plans, ensuring seamless coordination across the architecture.[28] Component interactions follow a linear flow: applications initiate connections and submit queries through the JDBC layer, which passes them to the Derby Engine's SQL module for parsing, optimization, and code generation; execution then interfaces with the Store layer for data access and modification, drawing on Services for auxiliary support like locking and caching to maintain consistency and performance. Cached plans from prior compilations accelerate repeated query processing by bypassing initial optimization steps.[28]Deployment modes
Apache Derby supports multiple deployment modes to accommodate various application requirements, ranging from simple single-user setups to multi-user networked environments. These modes leverage Derby's pure Java implementation, allowing flexible integration without external dependencies. The primary modes include embedded, network server, and embedded network server configurations, each optimized for specific use cases such as low-overhead desktop applications or scalable client-server architectures.[31] In embedded mode, Derby runs within the same Java Virtual Machine (JVM) as the hosting application, eliminating the need for a separate server process. This mode is particularly suited for single-user or low-concurrency scenarios, such as standalone desktop applications, where minimal overhead and tight integration are prioritized. Only one application can access the database at a time, and Derby boots automatically upon the first connection attempt using the EmbeddedDriver. Multi-threading is supported within the application, but concurrent access from multiple JVMs is not permitted, ensuring simplicity and isolation.[32][31] Network server mode operates as a standalone server process that accepts TCP/IP connections from multiple remote clients, enabling multi-user access to the same database instance. This setup uses the Distributed Relational Database Architecture (DRDA) protocol for communication and requires the Derby Network Client JDBC driver for client-side connections. It is ideal for distributed applications where multiple users or services need concurrent access, with the server managing authentication, connections, and resource allocation. The server can be started via command line usingderbyserver.jar, and it supports booting multiple databases within a single instance by specifying database names in connection URLs. Shutdown is performed using a dedicated command or connection URL, ensuring orderly closure without data loss.[32][31]
Embedded network server mode provides a hybrid approach, where the network server embeds directly into the application's JVM while still allowing remote client connections via the DRDA protocol. This balances the simplicity of embedded mode with the accessibility of network server mode, avoiding conflicts between the application and a separate server process. It is configured by setting the derby.drda.startNetworkServer property to automatically boot the server upon Derby startup, or programmatically using the NetworkServerControl class. Clients can connect using either the embedded driver locally or the network client driver remotely, supporting multi-database environments in a single JVM instance.[33][32]
Configuration basics across modes include setting the derby.system.home property to define the root directory for database storage, which defaults to the current working directory if unspecified; this ensures consistent file paths for data files and logs. Derby supports multi-database instances within one deployment by using unique names in connection URLs, allowing independent creation, access, and management of multiple databases without interference. Shutdown procedures vary by mode: in embedded setups, a connection URL with shutdown=true triggers closure, returning a specific SQLState for confirmation; in network modes, dedicated commands or controls handle graceful termination. These mechanisms facilitate reliable deployment in diverse Java environments.[31][32]
Features
Database capabilities
Apache Derby provides robust support for the SQL language, implementing a subset of the ANSI SQL-92 standard at the Entry, Transitional, and partial Intermediate levels. This includes core features such as data definition language (DDL) operations for creating and managing schemas, tables, and indexes, as well as data manipulation language (DML) operations like INSERT, UPDATE, DELETE, and complex SELECT statements supporting joins, subqueries, and aggregate functions.[34][35] The database supports a range of standard SQL data types, including numeric types such as SMALLINT, INTEGER, BIGINT, DECIMAL, NUMERIC, REAL, FLOAT, and DOUBLE PRECISION; character types like CHAR, VARCHAR, and LONG VARCHAR; temporal types including DATE, TIME, and TIMESTAMP; and large object types BLOB and CLOB. The XML data type, introduced in version 10.7, enables storage and manipulation of XML documents. Boolean types are also available for logical operations. Derby does not natively support arrays as a built-in data type. These types enable flexible storage and manipulation of diverse data, with operations adhering to SQL standards for assignments, comparisons, sorting, and ordering.[36] Derby extends basic SQL-92 functionality with select advanced features, such as the ROW_NUMBER() window function for ranking rows within partitions, introduced in version 10.4, along with support for a WINDOW clause to define named windows. However, it lacks support for common table expressions (CTEs), including recursive variants from SQL:2011, limiting its capability for certain hierarchical or iterative queries.[37][38] Transaction management in Derby ensures ACID (Atomicity, Consistency, Isolation, Durability) compliance through full transaction support, allowing commit and rollback operations. Concurrency is handled via locking at row or table levels, with support for multi-granularity locking and lock escalation, and four standard isolation levels: TRANSACTION_READ_UNCOMMITTED (allowing dirty reads), TRANSACTION_READ_COMMITTED (default, preventing dirty reads), TRANSACTION_REPEATABLE_READ (preventing non-repeatable reads), and TRANSACTION_SERIALIZABLE (full isolation, preventing phantoms via range locks). Deadlock detection is built-in, with a configurable timeout (default 60 seconds via derby.locks.deadlockTimeout) to abort one transaction and roll it back when cycles are identified.[39][40] Key limitations include the absence of native table partitioning, requiring manual application-level strategies for large-scale data distribution. Stored procedures, implemented as Java methods, were introduced in version 10.0, with a maximum of 90 parameters per procedure; pure SQL stored procedures are not supported. Database scalability is constrained by structural limits, such as a maximum of 1,012 columns per table, 32,767 indexes per table, and page sizes up to 32 KB, leading to practical size limits around 100 GB for typical deployments despite theoretical capacities exceeding 2^64 bytes.[41][42][43]Security and administration
Apache Derby provides robust security mechanisms to protect data integrity and access control. User authentication in Derby verifies the validity of user credentials before granting access, supporting built-in properties-based methods such as NATIVE authentication, which stores usernames and hashed passwords in database properties files. For enhanced security in production environments, Derby integrates with external systems like LDAP directories, allowing configuration of LDAP servers for centralized authentication and even guest access for anonymous users.[44] Authorization follows authentication, offering coarse-grained control where only the database owner can create schema objects, or fine-grained SQL-based privileges assigned to users and roles, including permissions for tables, views, and procedures via GRANT and REVOKE statements. Data encryption in Derby occurs at the database level using a boot password specified during creation with the dataEncryption=true attribute on the connection URL, employing configurable algorithms such as AES/CBC/PKCS5Padding for strong protection of files on disk. Existing unencrypted databases can be encrypted by booting with appropriate attributes, though this requires exclusive access. In network server mode, Derby secures client-server communications via SSL/TLS protocols, configurable through keystores for mutual authentication and encryption of traffic, ensuring protection against eavesdropping and tampering. Administrative tasks in Derby emphasize secure maintenance and monitoring. Backup and restore operations support roll-forward recovery in LOG ARCHIVE MODE, where transaction logs are archived to a directory for online backups using SYSCS_UTIL.SYSCS_BACKUP_DATABASE, allowing restoration via the restoreFrom attribute in the connection URL to recover from failures. Space reclamation is achieved through compaction with SYSCS_UTIL.SYSCS_COMPRESS_TABLE, which reorganizes tables and indexes to return unused space to the operating system after deletions or updates. Monitoring relies on system tables like SYS.SYSCHEMA for schema details, SYS.SYSCOLUMNS for column information, and SYS.SYSSTATEMENTS for query plans, enabling administrators to query database state without external tools. Performance tuning in Derby focuses on optimization for embedded and server deployments. Administrators update index statistics using SYSCS_UTIL.SYSCS_UPDATE_STATISTICS to improve query optimizer decisions, potentially reducing execution time by selecting better access paths. Query hints via Optimizer overrides allow manual specification of join orders or index usage when default plans underperform. JVM heap sizing, typically set via -Xmx flags, influences buffer pool efficiency, with recommendations for at least 256MB for moderate workloads to avoid garbage collection overhead. Derby performs effectively in multi-user scenarios with proper indexing and configuration.[45]Tools and utilities
Following the project's retirement on October 10, 2025, these tools are available in the final release (10.17.1.0) with no further development or updates planned.[4]Built-in tools
Apache Derby includes several built-in command-line tools designed for direct interaction, inspection, and diagnostics of databases, facilitating tasks such as SQL execution, schema extraction, and environment verification without requiring external dependencies. These tools are bundled with the Derby distribution and can operate in both embedded and client/server modes, leveraging the JDBC interface for connectivity.[46] The ij tool serves as an interactive SQL shell and scripting utility, enabling users to execute SQL statements, Derby-specific commands, and scripts against a database. It supports connections to embedded databases via the embedded JDBC driver or to network servers using the client driver, allowing seamless switching between modes. Key features include support for multiple simultaneous connections, transaction management, and batch processing for automation. To launch ij, users runjava org.apache.derby.tools.ij or use the provided script in the Derby bin directory. Basic commands include CONNECT 'jdbc:derby:sample'; to establish a connection to the sample database, and RUN 'script.sql'; to execute an SQL script file, which is useful for initializing or testing database setups. In batch mode, ij processes input files non-interactively, making it suitable for automated testing or deployment scripts.[46]
The dblook tool is a schema extraction utility that generates Data Definition Language (DDL) scripts from an existing Derby database, aiding in documentation, migration, or replication efforts. It connects to the database via a JDBC URL and outputs the schema for specified objects, such as tables, views, or the entire database, while preserving details like constraints and indexes. Users invoke it with java org.apache.derby.tools.dblook -d jdbc:derby:sample, where options like -t tableName limit output to a specific table or -z schemaName filters by schema. Output formats include standard SQL (default, with customizable statement delimiters via -td ';') for direct re-execution, and it can redirect results to a file using -o output.sql for portability across database systems. This tool does not support XML output natively but focuses on SQL compatibility for broad interoperability.[46]
The sysinfo tool provides a diagnostic overview of the Derby environment, displaying critical details such as the Derby version, Java Virtual Machine (JVM) properties, classpath configuration, and build information to assist in troubleshooting or compatibility checks. It requires no database connection and is executed simply as java org.apache.derby.tools.sysinfo, producing console output that includes the Derby release number (e.g., 10.17.1.0), supported locales, and loaded JAR files. This utility is particularly valuable for verifying installations, as it highlights potential issues like missing dependencies or mismatched versions before runtime errors occur. For example, running sysinfo might reveal the full classpath to ensure all Derby libraries are properly included.[46]
Development and management utilities
Apache Derby offers a range of programmatic utilities that enable developers to control the database engine at runtime through its JDBC APIs. The primary interface for embedded mode is the EmbeddedDriver class (org.apache.derby.jdbc.EmbeddedDriver), which applications load programmatically using Class.forName or DriverManager to establish connections and boot databases without external server processes.[47] These APIs facilitate seamless embedding within Java applications and support automated workflows for development cycles. Management tools in Derby extend beyond command-line interfaces to provide flexible runtime oversight. The DerbyRun.jar utility simplifies deployment by bundling all necessary Derby JAR files into a single executable, enabling straightforward launches of servers or tools, such as starting the Network Server with "java -jar derbyrun.jar NetworkServerControl start".[46] For monitoring, Derby integrates with Java Management Extensions (JMX) through managed beans (MBeans) that expose attributes and operations for system health, including version details, database status, and shutdown controls. Administrators can connect using JConsole, launched from the JDK's bin directory (e.g., "jconsole"), to select the Derby-running JVM and navigate to the "org.apache.derby" domain for real-time graphing of metrics like lock waits or connection counts.[48] Third-party extensions enhance Derby's management capabilities through its JDBC compliance. Tools like SQuirreL SQL Client integrate directly by registering Derby's JDBC drivers (derby.jar for embedded and derbyclient.jar for client modes) in the driver's panel and creating aliases with connection URLs such as "jdbc:derby:FirstDB;create=true" for embedded access or "jdbc:derby://localhost:1527/ClientDB" for networked setups.[49] Similarly, DBeaver supports Derby connections via its built-in JDBC driver configuration wizard, allowing schema browsing, query execution, and data visualization once the driver path and URL are specified.[50] For migrations from other databases, utilities like Apache DdlUtils provide ANT-based tasks to extract schemas and transfer data via JDBC, ensuring compatibility during transitions to Derby without proprietary lock-in.[51] Best practices for Derby utilities emphasize efficiency in automated environments and diagnostics. In CI/CD pipelines, scripting with JUnit harnesses enables automated testing of Derby-embedded applications, such as running regression suites on each commit to verify database integrity and performance.[52] For logging, the derby-debug.properties file, placed in the derby.system.home directory, configures detailed traces—such as enabling deadlock detection with "derby.locks.deadlockTrace=true" or statement logging with "derby.language.logStatementText=true"—but should be used judiciously to prevent excessive file growth, appending output via "derby.infolog.append=true" for persistent records.[53] These configurations, combined with selective property activation, support robust troubleshooting while maintaining system performance.Applications and integrations
Use cases
Apache Derby's lightweight footprint and pure Java implementation make it particularly suitable for embedded applications where a full relational database management system is needed without the overhead of a separate server. It excels in desktop software that requires local data persistence, such as contact management tools or personal productivity applications, allowing developers to bundle the database directly into the application's JAR file for seamless deployment. For instance, the Address Book demo illustrates Derby's use in a standalone Java desktop application for storing and managing user data like names, emails, and addresses, with the database file residing in the user's home directory.[54] Additionally, Derby supports interactive software that demands fast, embedded local storage, enabling single-user access without network dependencies. Its embedded mode ensures the database runs within the same JVM as the application, minimizing latency and resource usage.[55][56] Derby is widely adopted for testing and prototyping in Java development workflows, particularly for unit and integration tests where an in-memory or temporary database simulates production environments without persistent storage overhead. Developers often use its embedded mode to create disposable databases during test execution, ensuring isolation and repeatability; for example, it integrates with frameworks like JUnit and DBUnit to validate data access layers in Spring or JPA-based projects. This approach accelerates prototyping by allowing quick setup of relational schemas for ad-hoc queries and data validation, with automatic cleanup upon test completion.[56][57] For appliances and devices, Derby's small size—approximately 3.5 MB—and standards-compliant SQL make it ideal for resource-constrained environments, where a full RDBMS would be impractical due to memory and processing limits. It enables embedded data management for logging data, configuration storage, or local analytics in Java-enabled devices, supporting transaction integrity without requiring external infrastructure.[58][59] In legacy systems and migration contexts, Derby facilitates upgrades from predecessor technologies like Cloudscape, offering backward compatibility for data migration in small-scale enterprise applications. It is commonly bundled with platforms such as IBM WebSphere Application Server for test environments or Java SE distributions (as Java DB), providing a drop-in replacement for configuration and runtime data storage in integration servers or web applications. For example, organizations use Derby to migrate Cloudscape databases while preserving SQL syntax and features, ensuring minimal disruption in legacy Java ecosystems.[60][61][62]Java ecosystem integration
Apache Derby integrates seamlessly into the Java ecosystem through its pure Java implementation, enabling embedded usage within applications and compatibility with standard Java APIs and frameworks. As a fully JDBC-compliant database, Derby's primary integration point is its JDBC driver, which supports both embedded and client-server modes. To load the embedded driver in Java applications, developers typically useClass.forName("org.apache.derby.jdbc.EmbeddedDriver"); to register it with the DriverManager.[63] Connections are established via URLs such as jdbc:derby:mydb, where mydb specifies the database directory; this format allows Derby to create the database if it does not exist.[63] For Java 6 and later, automatic driver loading via the Service Provider mechanism often eliminates the need for explicit Class.forName calls, simplifying setup.[64]
Derby supports integration with popular Java frameworks, particularly those leveraging JPA and ORM technologies. For recent versions of Hibernate (6.x), use org.hibernate.dialect.DerbyDialect, which supports Derby 10.15.2 and later.[65] In Spring Boot applications, Derby is auto-configured as an embedded database when the spring-boot-starter-data-jpa dependency is present, with JPA support via the Hibernate dialect; developers can specify the dialect explicitly in application.properties as spring.jpa.database-platform=org.hibernate.dialect.DerbyDialect.[56] Build tools like Maven and Gradle facilitate inclusion through artifacts such as org.apache.derby:derby, which bundles the core engine and embedded JDBC driver; for example, a Maven dependency declaration is <dependency><groupId>org.apache.derby</groupId><artifactId>derby</artifactId><version>10.17.1.0</version></dependency>.[66]
Derby is bundled in distributions like Oracle's Java DB, which is essentially a supported release of Apache Derby, allowing developers to access it directly from JDK installations without separate downloads.[67] In web application environments, Derby embeds effortlessly into servlet containers such as Apache Tomcat; for instance, applications can deploy Derby-based data access within Tomcat by including the Derby JARs in the WEB-INF/lib directory and configuring connections in the servlet context, enabling persistent storage for web apps without an external database server.[68]
For advanced scenarios, Derby supports distributed transactions via the Java Transaction API (JTA) and XA interfaces, fully implementing the javax.transaction.xa package for two-phase commit protocols across multiple resources.[69] In modular applications, Derby provides OSGi-compatible bundles, such as those wrapping the core JARs (e.g., via org.apache.servicemix.bundles.derby), allowing it to function as an OSGi service within frameworks like Apache Felix or Karaf.[70] To ensure clean closure in embedded mode, applications often register JVM shutdown hooks using Runtime.getRuntime().addShutdownHook() to invoke DriverManager.getConnection("jdbc:derby:;shutdown=true");, performing checkpoints and releasing locks upon JVM termination.[71][72]
As of October 2025, Apache Derby has been retired into a read-only state, with no further development or bug fixes; however, existing applications and integrations remain functional.[4]