![](https://csdnimg.cn/release/download_crawler_static/1822326/bg4.jpg)
Version 10.5 Derby Developer's Guide
ii
Database-side JDBC routines using non-nested connections............................ 46
Database-side JDBC routines and SQLExceptions............................................ 46
User-defined SQLExceptions.............................................................................. 47
Programming trigger actions..................................................................................47
Trigger action overview....................................................................................... 47
Performing referential actions............................................................................. 48
Accessing before and after rows.........................................................................48
Examples of trigger actions.................................................................................48
Triggers and exceptions......................................................................................48
Programming Derby-style table functions............................................................ 49
Overview of Derby-style table functions..............................................................49
Example Derby-style table function.....................................................................51
Optimizer support for Derby-style table functions............................................... 51
Controlling Derby application behavior............................................................................56
The JDBC connection and transaction model......................................................56
Connections.........................................................................................................56
Transactions........................................................................................................ 57
Result set and cursor mechanisms.......................................................................60
Simple non-updatable result sets........................................................................60
Updatable result sets...........................................................................................61
Result sets and auto-commit...............................................................................65
Scrollable result sets...........................................................................................65
Holdable result sets.............................................................................................66
Locking, concurrency, and isolation..................................................................... 67
Isolation levels and concurrency.........................................................................68
Configuring isolation levels..................................................................................70
Lock granularity................................................................................................... 71
Types and scope of locks in Derby systems...................................................... 71
Deadlocks............................................................................................................ 74
Working with multiple connections to a single database....................................79
Deployment options and threading and connection modes................................ 79
Multi-user database access.................................................................................80
Multiple connections from a single application....................................................80
Working with multiple threads sharing a single connection...............................80
Pitfalls of sharing a connection among threads.................................................. 80
Multi-thread programming tips.............................................................................81
Example of threads sharing a statement............................................................ 82
Working with database threads in an embedded environment...........................82
Working with Derby SQLExceptions in an application........................................82
Information provided in SQL Exceptions.............................................................82
Using Derby as a J2EE resource manager...................................................................... 84
Classes that pertain to resource managers..........................................................84
Getting a DataSource.............................................................................................. 85
Shutting down or creating a database.................................................................. 85
Derby and Security............................................................................................................. 87
Configuring security for your environment.......................................................... 88
Configuring security in a client/server environment............................................ 89
Configuring security in an embedded environment.............................................89
Working with user authentication..........................................................................89
Enabling user authentication...............................................................................91
Defining users......................................................................................................91
External directory service....................................................................................92
Built-in Derby users.............................................................................................96
List of user authentication properties.................................................................. 97