Avoid having multiple Artifacts updating data on the same SQL Table | CAST Appmarq

Avoid having multiple Artifacts updating data on the same SQL Table


Rule Definition
One main source of data corruption within applications comes from lack of compliance to data modification rules defined for an application. These rules are usually related to the use of specific procedures for update/insert/delete, a specific API or a data layer that is fully tested to maintain data integrity. The creation of new, different update/insert/delete procedures and functions that do not make use the existing tested code is at origin of many data corruption cases.

Violation Code Sample
import java.sql.*;

public class TestUpdate1 {

  public static void main(java.lang.String[] args) {

       String query = "UPDATE books SET books.title = 'MyTest' WHERE books.id=1";

       try {
          Statement stmt = con.createStatement();
          results = stmt.executeQuery(requete);

       } catch (SQLException e) {

         // ...
       }
  }
}

// ... X classes update the same table

public class TestUpdateX {

  public static void main(java.lang.String[] args) {

       String query = "UPDATE books SET books.title = 'MyTest' WHERE books.id=1";

       try {
          Statement stmt = con.createStatement();
          results = stmt.executeQuery(requete);

       } catch (SQLException e) {

         // ...
       }
  }
}
Fixed Code Sample
import java.sql.*;

// less than X classes update the same table

public class TestUpdate {

  public static void main(java.lang.String[] args) {

       String query = "UPDATE books SET books.title = 'MyTest' WHERE books.id=1";

       try {
          Statement stmt = con.createStatement();
          results = stmt.executeQuery(requete);

       } catch (SQLException e) {

         // ...
       }
  }
}

Related Technologies
DB2 Server Forms PL/SQL Microsoft T-SQL Sybase T-SQL DB2 z/OS SQLScript

Health Factor

  Security


Technical Criterion
Architecture - Multi-Layers and Data Access

About CAST Appmarq

CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.

Benchmark Statistics

Global Compliance

91.34%

Total Violations
107,718
Total Opportunities
1,244,459
Average Violations / App.
55.67
The compliance score represents 1 minus the ratio between the number of times a rule has been violated compared to the number of opportunities in a set of applications that the rule could have been violated.

Industry Insights

Select from drop-down

93.43%

Financial Services

93.68%

Software ISV

88.43%