Description: Methods invoked within an application are called application-side methods. Methods invoked within Derby are called database-side procedures.
Keywords: Database-side JDBC procedures

# Programming database-side JDBC procedures

Methods invoked within an application are called application-side methods. Methods invoked within Derby are called database-side procedures.

An application-side method can be exactly the same as a database-side procedure. The only difference is where you invoke them. You write the method only once. Where you invoke the method-within the application or within an SQL statement-determines whether it is an "application-side" or a "database-side" method.

- Database-side JDBC procedures and nested connections
  Most database-side JDBC Procedures need to share the same transaction space as the statements that called them.
- Database-side JDBC procedures using non-nested connections
  A database-side JDBC procedure can create a new connection instead of using a nested connection. Statements executed in the procedure will be part of a different transaction, and so can issue commits and rollbacks.
- Database-side JDBC procedures and SQLExceptions
  It is possible to code database-side procedures, like application-side methods, to catch SQLExceptions. SQLExceptions that are caught within a procedure are hidden from the calling application code.
- User-defined SQLExceptions
  When the execution of a database-side method raises an error, Derby wraps that exception in an SQLException with an SQLState of 38000.

Parent topic: Derby server-side programming
Related concepts
Programming trigger actions
Nested connections