background image
<< Contents 1 | Contents 3 >>
<< Contents 1 | Contents 3 >>

Contents 2

Version 10.8 Derby Developer's Guide
ii
Database-side JDBC routines and nested connections...................................... 47
Database-side JDBC routines using non-nested connections............................ 48
Database-side JDBC routines and SQLExceptions............................................ 48
User-defined SQLExceptions.............................................................................. 49
Programming trigger actions..................................................................................49
Trigger action overview....................................................................................... 49
Performing referential actions............................................................................. 50
Accessing before and after rows.........................................................................50
Examples of trigger actions.................................................................................50
Triggers and exceptions...................................................................................... 50
Programming Derby-style table functions............................................................ 51
Overview of Derby-style table functions..............................................................51
Example Derby-style table function.....................................................................53
Writing restricted table functions......................................................................... 54
Optimizer support for Derby-style table functions............................................... 56
Programming user-defined types...........................................................................59
Controlling Derby application behavior............................................................................63
The JDBC connection and transaction model......................................................63
Connections......................................................................................................... 63
Transactions........................................................................................................ 64
Result set and cursor mechanisms....................................................................... 67
Simple non-updatable result sets........................................................................67
Updatable result sets...........................................................................................68
Result sets and auto-commit...............................................................................72
Scrollable result sets........................................................................................... 72
Holdable result sets.............................................................................................73
Locking, concurrency, and isolation..................................................................... 74
Isolation levels and concurrency......................................................................... 75
Configuring isolation levels..................................................................................77
Lock granularity................................................................................................... 78
Types and scope of locks in Derby systems...................................................... 78
Deadlocks............................................................................................................ 82
Working with multiple connections to a single database....................................86
Deployment options and threading and connection modes................................ 86
Multi-user database access.................................................................................87
Multiple connections from a single application....................................................87
Working with multiple threads sharing a single connection...............................88
Pitfalls of sharing a connection among threads.................................................. 88
Multi-thread programming tips.............................................................................88
Example of threads sharing a statement............................................................ 89
Working with database threads in an embedded environment...........................89
Working with Derby SQLExceptions in an application........................................ 90
Information provided in SQL Exceptions.............................................................90
Using Derby as a Java EE resource manager................................................................. 92
Classes that pertain to resource managers..........................................................92
Getting a DataSource.............................................................................................. 93
Shutting down or creating a database.................................................................. 93
Derby and security..............................................................................................................95
Configuring security for your environment.......................................................... 96
Configuring security in a client/server environment............................................ 96
Configuring security in an embedded environment.............................................97
Working with user authentication.......................................................................... 97
Enabling user authentication............................................................................... 98
Defining users......................................................................................................99