Altova DiffDog Server 2023 

The data-diff command runs one or more database data comparison jobs configured previously. By default, the comparison result is displayed at the command line in XML format. You can control the output kind (text, XML) by setting the output-mode option from the configuration file. The path of the output file is set from either the client-output-path or server-output-path options. For more information about setting up database comparison jobs, see Comparing CSV and Database Data.

 

Running *.dbdif files with DiffDog Server is most convenient if DiffDog Server runs either on the same computer as DiffDog desktop, or on a Windows machine. If DiffDog Server runs on a different machine or operating system, the following limitations apply:

 

If the comparison involves CSV files, running .dbdif files is supported only on Windows servers. For the comparison to be successful, all the CSV file paths that were valid on the desktop machine must be valid on the server machine.

If database connections are involved, the server machine must be configured and capable to handle the database connection. Namely, the database drivers and any other prerequisites required by the connection must be present on the target operating system as well. For example, if the .dbdif file includes a connection that requires an ODBC driver from the database vendor, that driver must be installed on the server machine as well. Note that some database connection methods supported on Windows are not supported on Linux and macOS. For more information, see Supported Databases.

 

If you set up comparison jobs directly in DiffDog Server (as opposed to using *.dbdif files), you can run them regardless of the platform.

 

To get the comparison outcome as a numeric value, check the value of the %ERRORLEVEL% environment variable after running this command. The possible values are:

 

Exit code

Meaning

0

No differences exist

1

Differences exist

2

An error has occurred

 

Syntax

DiffDogCmdlClient data-diff [options] {job} ...

 

Where job refers to a [datadiff] section defined in the client configuration file. You can specify the job argument more than once in order to run multiple database comparison jobs in one run of the command.

 

On Linux, use an all-lowercase to call the executable. In addition, on Linux and macOS, you might need to add the prefix "./" before the name of the executable when calling it from the current directory of the command shell.

 

This command can also be called using the compare-data alias. You can use compare-data and data-diff interchangeably.

 

Options

The options applicable to the data-diff command are listed below.

 

--config, --c

This option specifies the path to a configuration file where the <named_datadiff> was defined.

 

If you do not set the --c option, the DiffDog Command Line Client executable attempts to read the client configuration file from the same directory. If there is no configuration file in the same directory as the executable, the default values as described in the command line help and this documentation apply.

 

--loglevel, --L

Sets the reporting level for information, warning, and error messages. Valid values:

 

none

Suppress all logging.

info

Report information, warning, and error messages.

warning

Report error and warning messages.

error

(Default) Report only error messages.

 

--port

This option specifies the port on which DiffDog Server listens for requests. Setting this option is meaningful if DiffDog Server runs on a port other than the default 29800. As an alternative to setting this option at the command line, you can set it in the Client Configuration File. Note that, if you set this value at the command line, it takes precedence over the one defined in the configuration file.

 

--quiet, --q

Prevents the standard output from being displayed at the command line. Valid values:

 

true

Do not display standard output in the terminal window.

false

(Default) Display standard output in the terminal window.

 

--output-mode, --om

This option specifies the format of the comparison report. Valid values:

 

text

Output the report in text format.

sql

Output the report in SQL format. This value is meaningful when the right side of the data comparison is a database. It contains SQL statements that merge data from the left to the right side of the comparison. For example, if there are missing rows on the right, INSERT statements are generated. Conversely, if there are extra rows on the right, DELETE statements are generated. For changed values, UPDATE statements are generated.

xml

Output the report in XML format.

 

The default option is sql. However, when the left side of the comparison is a database and the right side is a CSV file, the default option is text.

 

--server

This option specifies the server address on which DiffDog Server listens for requests. Setting this option is meaningful if DiffDog Server runs on a server other than the default localhost. As an alternative to setting this option at the command line, you can set it in the Client Configuration File. Note that, if you set this value at the command line, it takes precedence over the one defined in the configuration file.

 

Example

The following command runs a single database data comparison job called "reports".

 

DiffDogCmdlClient data-diff reports

 

It is assumed that the client configuration file contains a [datadiff:reports] section, for example:

 

[datasource:left_data]
type = sqlite
path = c:\comparisons\db\Nanonull_Left.sqlite
table = "main"."products"
 
[datasource:right_data]
type = adonet

connection = Data Source=SQLSERV16;Initial Catalog=NANONULL;MultipleActiveResultSets=True;Password=7hiu57;Persist Security Info=True;User ID=altova

assembly = System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

class = System.Data.SqlClient

table = [NANONULL].[dbo].[PRODUCTS]
 
[datadiff:reports]
left = left_data
right = right_data
map = 1 => 1, 2 => 2, 3 => 3

output-mode=text

client-output-path=c:\comparisons\db\esult.txt

 

In the configuration file above, the [datasource:left_data] and [datasource:right_data] are two data sources that provide data for the left and right side of the comparison. The left_data points to table "products" from a local SQLite database. The right_data points to table "PRODUCTS" of a SQL Server database. Both tables have a primary key, so it is not necessary to specify a key column using the option key-column-by-name.

 

The [datadiff:reports] section sets both data sources above as the left and right side of the comparison. In addition, it maps the columns that are to be compared. In this example, the first, second, and third columns from the left are mapped with the first, second, and third columns from the right, respectively. The comparison result is set to be in text format and it will be saved to a local text file.

 

This is not an exhaustive list of options; for reference to all the options you can define in a data source, see Setting up Data Sources. For options you can define in a database comparison job, see Setting up CSV and Database Comparisons.

© 2016-2022 Altova GmbH