Comparing CSV and Database Data
With DiffDog Server, you can compare database tables, views, or custom recordsets retrieved with the help of SQL queries. In addition, you can add CSV files as data sources and compare them with other CSV files or with database tables, views, or custom recordsets, see CSV Comparisons.
There are two ways to run tabular comparisons in DiffDog Server:
1.Set up a database comparison job in the client configuration file. Once the comparison job is set up, you can run it from the command line by invoking the data-diff command, for example:
<exec> data-diff <named_datadiff>
Where <named_datadiff> refers to a [datadiff] section configured previously in the configuration file.
2.Run an existing database data comparison file (.dbdif) previously created with DiffDog Enterprise Edition. For more information about creating database data comparison files, refer to the documentation of DiffDog, see https://www.altova.com/documentation. When you have a .dbdif file, you can run it with the following command:
<exec> run <dbdiff-file>
If you run the .dbdif file with DiffDog Server on a different machine or operating system, the database drivers required by the connection must be installed on the target operating system as well. Note that some database connections methods supported on Windows are not supported on Linux and macOS, see also Supported Databases.
The steps below provide an overview of how you can set up and run database comparisons in DiffDog Server (the first approach above). For more information about the second approach, see the run command.
Step 1: Configure the data sources
First, you define two data sources in the client or server configuration file. For each data source, you must specify all the details required to connect to a database and retrieve a table, view, or some custom recordset that will take part in the comparison. For example, you might want to compare the view VWEMPLOYEEDATA from an Oracle database with the table EMPLOYEES from a SQLite database. Consequently, you would need to create two data sources: the first one to connect to the Oracle database, and the second one to connect to the SQLite database.
You can define data sources on the machine where DiffDog Command Line client runs, on the server machine, or both. For more information about this step, see Setting up Data Sources.
Step 2: Configure the database comparison job (datadiff)
Next, you define a [datadiff] section (a database comparison) in the configuration file. A database comparison consists of a "left" side and a "right" side. Consequently, in the datadiff section, you specify which of the data sources defined earlier must represent the "left" and "right" side of the comparison. It is also recommended that the datadiff section should specify all the mappings between the left and the right columns. For example, you may want to compare data as follows:
•Column ID from the left with column SERNO from the right
•Column FULLNAME from the left with column NAME from the right
•Column JOBTITLE from the left with column TITLE from the right.
For more information about this step, see Setting up CSV and Database Comparisons.
Step 3: Run the comparison
Once the previous steps are done, you can run the comparison using the data-diff command, for example:
<exec> data-diff <named_datadiff>
Where <named_datadiff> refers to a [datadiff] section configured previously in the configuration file. For more information, see the reference to the data-diff command.