Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ Ftl2Jcl/target/maven-archiver/pom.properties
Ftl2Jcl/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
Ftl2Jcl/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
Ftl2Jcl/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
DB2CHECK/target/db2check-1.0.0-jar-with-dependencies.jar
DB2CHECK/target/db2check-1.0.0.jar
DB2CHECK/target/classes/application.properties
DB2CHECK/target/classes/org/genevaers/db2check/CommandLineHandler.class
DB2CHECK/target/classes/org/genevaers/db2check/GersEnvironment.class
DB2CHECK/target/classes/org/genevaers/db2check/TemplateApplier.class
DB2CHECK/target/maven-archiver/pom.properties
DB2CHECK/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
DB2CHECK/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
DB2CHECK/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaValidateMain.class
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaConfig.class
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaValidateA.class
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaValidateB.class
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaValidateC.class
DB2CHECK/target/classes/org/genevaers/db2check/GvbSchemaValidateD.class
DB2CHECK/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
FTL2JCL/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
43 changes: 43 additions & 0 deletions DB2CHECK/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Validation of GenevaERS DB2 Schema definition

This application is provided to allow you to validate the DB2 schema has been correctly defined. It is written in Java and uses JDBC driver for DB2. The program uses digest values for each of the following sets of schema definitions to ensure correctlness. This validates the correctness of the schema structure.

## DB2 schema items checked
<pre>
1) stored procedures
2) table definitions
3) index definitions
4) foreign keys
</pre>

## Configuration file

This contains the userid, password, url of DB2 target and a matching value for the name of schema. It must be located in your home directory.
<pre>
USERID
RACFPWD
jdbc:db2://SP13.pok.stglabs.ibm.com:5036/DM13
SAFR0002
</pre>

## Compiling the program

From directory DB2CHECK/ use the command:
<pre>
mvn install
</pre>

## Executing the program

From directory DB2CHECK/target/ use the command:
<pre>
java -jar db2check-1.0.1-jar-with-dependencies.jar
</pre>

## Command line options

From directory DB2CHECK/target/ use the command:
This generates files containing your schema definitions
<pre>
java -jar db2check-1.0.1-jar-with-dependencies.jar -D
</pre>
30 changes: 30 additions & 0 deletions DB2CHECK/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Copyright Contributors to the GenevaERS Project.
# SPDX-License-Identifier: Apache-2.0 (c) Copyright IBM Corporation
# 2008
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
mvn clean
mvn install $1

export rev=`grep "<revision>" pom.xml | awk -F'<revision>||</revision>' '{print $2}'`;
echo DB2CHECK release number $rev;

cp ./target/*-jar-with-dependencies.jar $GERS_RCA_JAR_DIR/db2check-$rev.jar;

cd $GERS_RCA_JAR_DIR;

touch db2check-latest.jar;
rm db2check-latest.jar;
ln -s db2check -$rev.jar db2check-latest.jar;
148 changes: 148 additions & 0 deletions DB2CHECK/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright Contributors to the GenevaERS Project.
SPDX-License-Identifier: Apache-2.0 (c) Copyright IBM Corporation
2008

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<organization>
<name>Geneva ERS</name>
<url>https://genevaers.org/</url>
</organization>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<min.jdk.version>11</min.jdk.version>
<maven.compiler.release>8</maven.compiler.release>
<maven-version>3.8.4</maven-version>
<surefire-version>2.22.2</surefire-version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<!-- our apps -->
<revision>1.0.1</revision>
</properties>

<groupId>org.genevaers</groupId>
<artifactId>db2check</artifactId>
<version>${revision}</version>

<name>GenevaERS Build</name>
<description>GenevaERS Test Apps</description>

<dependencies>
<dependency>
<groupId>com.google.flogger</groupId>
<artifactId>flogger</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>com.google.flogger</groupId>
<artifactId>flogger-system-backend</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.32</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc_license_cu</artifactId>
<version>4</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc4</artifactId>
<version>4</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc_license_cisuz</artifactId>
<version>4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.genevaers.db2check.GvbSchemaValidateMain</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>application.properties</include>
</includes>
</resource>
</resources>
</build>

</project>
66 changes: 66 additions & 0 deletions DB2CHECK/src/main/java/org/genevaers/db2check/GvbSchemaConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.genevaers.db2check;

import java.io.BufferedWriter;
import java.sql.*;
import java.util.HashMap;

public class GvbSchemaConfig {

private String digestType;
private Connection con;
private String schema_mask;
private Boolean makeHash;
private Boolean makeDef;
private BufferedWriter fwriter;
private BufferedWriter hwriter;
private BufferedWriter[] dwriter;
private HashMap<String, String> spmap;
private HashMap<String, String> tbmap;
private HashMap<String, String> ixmap;
private HashMap<String, String> fkmap;

// Constructor
public GvbSchemaConfig(String digestType, Connection con, String schema_mask, Boolean makeHash, Boolean makeDef,
BufferedWriter fwriter, BufferedWriter hwriter, BufferedWriter dwriter[],
HashMap<String, String> spmap, HashMap<String, String> tbmap, HashMap<String, String> ixmap, HashMap<String, String> fkmap)
{
this.digestType = digestType;
this.con = con;
this.schema_mask = schema_mask;
this.makeHash = makeHash;
this.makeDef = makeDef;
this.fwriter = fwriter;
this.hwriter = hwriter;
this.dwriter = dwriter;
this.spmap = spmap;
this.tbmap = tbmap;
this.ixmap = ixmap;
this.fkmap = fkmap;
}

public String getDigestType() { return digestType; }
public Connection getCon() { return con; }
public String getSchemaMask() { return schema_mask; }
public Boolean getMakeHash() { return makeHash; }
public Boolean getMakeDef() { return makeDef; }
public BufferedWriter getFwriter() { return fwriter; }
public BufferedWriter getHwriter() { return hwriter; }
public BufferedWriter[] getDwriter() { return dwriter; }
public HashMap<String, String> getSpmap() { return spmap;}
public HashMap<String, String> getTbmap() { return tbmap;}
public HashMap<String, String> getIxmap() { return ixmap;}
public HashMap<String, String> getFkmap() { return fkmap;}

public void setDigestType(String digestType) { this.digestType = digestType; }
public void setCon(Connection con) {this.con = con; }
public void setSchemaMask(String schema_mask) {this.schema_mask = schema_mask; }
public void setMakeHash(Boolean makeHash) {this.makeHash = makeHash; }
public void setMakeDef(Boolean makeDef) {this.makeDef = makeDef; }
public void setFwriter(BufferedWriter fwriter) {this.fwriter = fwriter; }
public void setHwriter(BufferedWriter hwriter) {this.hwriter = hwriter; }
public void setDwriter(BufferedWriter[] dwriter) {this.dwriter = dwriter; }
public void setSpmap(HashMap<String, String> spmap) {this.spmap = spmap;}
public void setTbmap(HashMap<String, String> tbmap) {this.tbmap = tbmap;}
public void setIxmap(HashMap<String, String> ixmap) {this.ixmap = ixmap;}
public void setFkmap(HashMap<String, String> fkmap) {this.fkmap = fkmap;}
}
Loading