Derby You can store application logic in a database and then load classes from the database. Step 1: create your application jar file jar cf travelagent.jar travelagent/*.class Step 2: Add the jar file or files to the database. when you install jar file in database, you give it a Derby jar name, which is SQL92Identifier. CALL sqlj.install_jar('tours.jar', 'APP.Sample1', 0) Step 3: Enable database class loading by setting the property "derby.database.classpath" : CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY( 'derby.database.classpath', 'APP.ToursLogic:APP.ACCOUNTINGLOGIC') Note: Derby's class loader looks first in the user's classpath for any needed classes, and then in the database. Step 4: Question: Is class loading from db only for embedded db or for network db also? Question: Derby Server side programming : - database side JDBC procedures can be defined and called within SQL statements. They are, then, executed in derby server side. - The database side method calls following to get current connection: Connection conn = DriverManager.getConnection("jdbc:default:connection"); This connection is called nested connection and always has its autocommit mode set to false. Trigger action overview CREATE TRIGGER . . . DELETE FROM flightavailability WHERE flight_id IN (SELECT flight_id FROM flightavailability WHERE YEAR(flight_date) < 2005);) Many trigger actions need to access the values of the rows being changed. Such trigger actions need to know one or both of the following: * the "before" values of the rows being changed (their values before the database event that caused the trigger to fire) * the "after" values of the rows being changed (the values to which the database event is setting them) JDBC Transacations Model - By default JDBC connection autocommit is enabled, so each sql is transaction. - Use conn.setAutoCommit(false) to disable autocommit. - Connection conn.commit, conn.rollback can be called explicitly - (updatabale) Result Set can be used to delete/update values as well: Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet uprs = stmt.executeQuery( "SELECT FIRSTNAME, LASTNAME, WORKDEPT, BONUS " + "FROM EMPLOYEE"); while (uprs.next()) { int newBonus = uprs.getInt("BONUS") + 100; uprs.updateInt("BONUS", newBonus); uprs.updateRow(); // or uprs.deleteRow(); } - (scrollable updatable) result set can also move cursors to anywhere ... Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet uprs = stmt.executeQuery( "SELECT FIRSTNAME, LASTNAME, WORKDEPT, BONUS " + "FROM EMPLOYEE"); uprs.absolute(5); // update the fifth row int newBonus = uprs.getInt("BONUS") + 100; uprs.updateInt("BONUS", newBonus); uprs.updateRow(); - Default derby isolation level is TRANSACTION_READ_COMMITTED - Derby supports XML data type. - Does derby SQL support Begin; ... End; syntax ? -