Copyright
License
Relationship between Java DB and Derby
About this guide
Purpose of this guide
Audience
How this guide is organized
Upgrades
Preparing to upgrade
Upgrading a database
Soft upgrade limitations
JDBC applications and Derby basics
Application development overview
Derby embedded basics
Derby JDBC driver
Derby JDBC database connection URL
Derby system
One Derby instance for each Java Virtual Machine
Booting databases
Shutting down the system
Defining the system directory
The error log
derby.properties
Double-booting system behavior
Recommended practices
A Derby database
The database directory
Creating, dropping, and backing up databases
Single database shutdown
Storage and recovery
Log on separate device
Database pages
Database-wide properties
Derby database limitations
Connecting to databases
Connecting to databases within the system
Connecting to databases outside the system directory
Conventions for specifying the database path
Special database access
Accessing databases from the classpath
Accessing databases from a jar or zip file
Database connection examples
Working with the database connection URL attributes
Using the databaseName attribute
Shutting down Derby or an individual database
Creating and accessing a database
Providing a user name and password
Creating a database with territory-based collation
Encrypting a database when you create it
Creating an encrypted database with an external key
Booting an encrypted database
Specifying attributes in a properties object
After installing
The installation directory
Batch files and shell scripts
Derby and JVMs
Derby libraries and classpath
UNIX-specific issues
Configuring file descriptors
Scripts
Derby embedded basics
Embedded Derby JDBC driver
Embedded Derby JDBC database connection URL
Getting a nested connection
Starting Derby as an embedded database
Deploying Derby applications
Deployment issues
Embedded deployment application overview
Deploying Derby in an embedded environment
Embedded systems and properties
Creating Derby databases for read-only use
Creating and preparing the database for read-only use
Deploying the database on the read-only media
Transferring read-only databases to archive (jar or zip) files
Accessing a read-only database in a zip/jar file
Accessing databases within a jar file using the classpath
Connecting to databases with ambiguous paths to databases in the file system
Connecting to databases when the path is ambiguous because of databases in the classpath
Databases on read-only media and DatabaseMetaData
Loading classes from a database
Class loading overview
Create jar files for your application
Add the jar file or files to the database
Jar file examples
Installing jar files
Removing jar files
Replacing jar files
Enable database class loading with a property
Code your applications
Dynamic changes to jar files or to the database jar classpath
Requirements for dynamic changes
Notes on dynamic changes
Derby server-side programming
Programming database-side JDBC procedures
Database-side JDBC procedures and nested connections
Requirements for database-side JDBC procedures using nested connections
Database-side JDBC procedures using non-nested connections
Invoking a procedure using the CALL command
Database-side JDBC procedures and SQLExceptions
User-defined SQLExceptions
Programming trigger actions
Trigger action overview
Performing referential actions
Accessing before and after rows
Examples of trigger actions
Triggers and exceptions
Aborting statements and transactions
Controlling Derby application behavior
The JDBC Connection and Transaction Model
Connections
Statements
ResultSets and Cursors
Nested connections
Transactions
Transactions when auto-commit is disabled
Using auto-commit
Turning off auto-commit
Explicitly closing Statements, ResultSets, and Connections
Statement versus transaction runtime rollback
Result set and cursor mechanisms
Simple non-updatable result sets
Updatable result sets
Requirements for updatable result sets
Forward only updatable result sets
Scrollable updatable result sets
Inserting rows with updatable result sets
Naming or accessing the name of a cursor
Extended updatable result set example
Result sets and auto-commit
Scrollable result sets
Holdable result sets
Holdable result sets and autocommit
Non-holdable result set example
Locking, concurrency, and isolation
Isolation levels and concurrency
Configuring isolation levels
Lock granularity
Types and scope of locks in Derby systems
Exclusive locks
Shared locks
Update locks
Lock compatibility
Scope of locks
Notes on locking
Deadlocks
Avoiding deadlocks
Deadlock detection
Lock wait timeouts
Configuring deadlock detection and lock wait timeouts
Debugging Deadlocks
Programming applications to handle deadlocks
Working with multiple connections to a single database
Deployment options and threading and connection modes
Multi-user database access
Multiple connections from a single application
Working with multiple threads sharing a single connection
Pitfalls of sharing a connection among threads
Multi-thread programming tips
Example of threads sharing a statement
Working with database threads in an embedded environment
Working with Derby SQLExceptions in an application
Information provided in SQL Exceptions
Example of processing SQLExceptions
Using Derby as a J2EE resource manager
Classes that pertain to resource managers
Getting a DataSource
Shutting down or creating a database
Derby and Security
Configuring security for your environment
Configuring security in a client/server environment
Configuring security in an embedded environment
Working with user authentication
Enabling user authentication
Defining users
External directory service
LDAP directory service
Libraries for LDAP user authentication
Setting up Derby to use your LDAP directory service
Guest access to search for DNs
LDAP performance issues
Considerations when using Windows NT with LDAP
LDAP restrictions
JNDI-specific properties for external directory services
User-defined class
Example of setting a user-defined class
Built-in Derby users
Database-level properties
System-level properties
List of user authentication properties
Programming applications for Derby user authentication
Programming the application to provide the user and password
Login failure exceptions with user authentication
Users and authorization identifiers
Authorization identifiers, user authentication, and user authorization
Database owner
User names and schemas
Exceptions when using authorization identifiers
User authorizations
Setting the SQL standard authorization mode
Setting the default connection access mode
Setting the user authorizations for individual users
SQL standard authorization
User authorization exceptions
Read-only and full access permissions
Encrypting databases on disk
Requirements for Derby encryption
Working with encryption
Encrypting databases on creation
Encrypting an existing unencrypted database
Creating the boot password
Specifying an alternate encryption provider
Specifying an alternate encryption algorithm
Encrypting databases with a new key
Encrypting databases with a new boot password
Encrypting databases with a new external encryption key
Booting an encrypted database
Changing the boot password
Signed jar files
Notes on the Derby security features
User authentication and authorization examples
User authentication example in a client/server environment
User authentication example in a single-user, embedded environment
User authentication and authorization extended examples
Running Derby under a security manager
Granting permissions to Derby
Examples of Java 2 security policy files for embedded Derby
Java 2 security policy file example 1
Java 2 security policy file example 2
Java 2 security policy file example 3
Developing tools and using Derby with an IDE
Offering connection choices to the user
The DriverPropertyInfo Array
DriverPropertyInfo array example
Using Derby with IDEs
IDEs and multiple JVMs
SQL tips
Retrieving the database connection URL
Supplying a parameter only once
Defining an identity column
Using third-party tools
Tricks of the VALUES clause
Multiple rows
Mapping column values to return values
Creating empty queries
Localizing Derby
SQL parser support for Unicode
Character-based collation in Derby
Other components
Messages libraries
Derby and standards
XML data types and operators
Trademarks