Version 10.4 Derby Developer's Guide
ii
Trigger action overview....................................................................................... 41
Performing referential actions............................................................................. 42
Accessing before and after rows.........................................................................42
Examples of trigger actions.................................................................................42
Triggers and exceptions......................................................................................42
Programming Derby-style table functions............................................................ 43
Overview of Derby-style table functions..............................................................43
Example Derby-style table function.....................................................................45
Optimizer support for Derby-style table functions............................................... 45
Controlling Derby application behavior............................................................................50
The JDBC connection and transaction model......................................................50
Connections.........................................................................................................50
Transactions........................................................................................................ 51
Result set and cursor mechanisms.......................................................................54
Simple non-updatable result sets........................................................................54
Updatable result sets...........................................................................................55
Result sets and auto-commit...............................................................................59
Scrollable result sets...........................................................................................59
Holdable result sets.............................................................................................60
Locking, concurrency, and isolation..................................................................... 61
Isolation levels and concurrency.........................................................................62
Configuring isolation levels..................................................................................64
Lock granularity................................................................................................... 65
Types and scope of locks in Derby systems...................................................... 65
Deadlocks............................................................................................................ 68
Working with multiple connections to a single database....................................73
Deployment options and threading and connection modes................................ 73
Multi-user database access.................................................................................74
Multiple connections from a single application....................................................74
Working with multiple threads sharing a single connection...............................74
Pitfalls of sharing a connection among threads.................................................. 74
Multi-thread programming tips.............................................................................75
Example of threads sharing a statement............................................................ 76
Working with database threads in an embedded environment...........................76
Working with Derby SQLExceptions in an application........................................76
Information provided in SQL Exceptions.............................................................76
Using Derby as a J2EE resource manager...................................................................... 78
Classes that pertain to resource managers..........................................................78
Getting a DataSource.............................................................................................. 79
Shutting down or creating a database.................................................................. 79
Derby and Security............................................................................................................. 81
Configuring security for your environment.......................................................... 82
Configuring security in a client/server environment............................................ 83
Configuring security in an embedded environment.............................................83
Working with user authentication..........................................................................83
Enabling user authentication...............................................................................85
Defining users......................................................................................................85
External directory service....................................................................................86
Built-in Derby users.............................................................................................90
List of user authentication properties.................................................................. 91
Programming applications for Derby user authentication....................................92
Users and authorization identifiers........................................................................93
Authorization identifiers, user authentication, and user authorization................. 93
Database owner .................................................................................................94