Category Archives: Internship Notes

Day 36 – Record Locking

Published by:


Solution

  • If database monitors locking process too frequent, leads to inefficiency.


Optimistic Locking – UPDATE, COMMIT

  • Lock when there is a change or updates
  • Both users can retrieve the record
  • When the user updates the record, the database will lock user A to disallow user A to update.

  • Problems

    • User A (value=1000, rcdversion=1)
    • User B (value=1000, rcdversion=1) – If update, rcdversion+1
    • After the update:User A: rcdversion=1User B: rcdversion=2


    Solution

    UPDATE <table>

    SET …..

    rcdversion=rcdversion+1

    WHERE primarykey=”…..”

    AND rcdversion=original value

    Commitment Control

    • Maintains integrity of database where each ‘logical’ transaction consist of multiple updates or inserts or deletes. (Receiver and Sender)
    • Logical transactions happened, updates three tables.
    • If one of them not updates, the transaction is rollback.
      conn.setAutoCommit(true);
      conn.setAutoCommit(false);
    • take control
    • will update until execute

    update statements

    conn.commit();
    conn.rollback();

    If master file splits, more secure because master file being copied by others is meaningless.

    E.g. code tables

    • country codes
    • currency codes

    Standalone and Dependent

    • Master file
    • Code file
    • Transaction file
    • Audit log file

    • Triggers: Automatic
    • Stored Procedures: functions to be called.
    • Oracle/PostgreSQL: PL/SQL
    • Microsoft SQL Server: Transact/SQL

    • Do not display for the first time until field entered.
    • AssetMasterBean(Collection) – FaultsBean

    Day 32 – Fault Report

    Published by:

    iReport – To use the grouping feature

    1. Under the ‘data’ sub-menu under Report Query
      • the SQL statement must have ‘ORDER BY’ clause.
    2. Click on group icon
    3. Click on ‘add’ button to add on or more groups.
      • Add 2 groups (companyid and assetid)
      • group name = any descriptive name (e.g. By company, By assetid)
      • group expression = the control field (e.g. $F{companyid}
    4. After the groups have been defined
    • The appropriate bands will be created