Sync the relational model data with a database from the command line

LLBLGen Pro ships with a command line tool: CliSyncWithDatabase.exe for syncing the relational model data of a project with a database from the command line. This tool is available in the LLBLGen Pro installation folder and its sourcecode is available in the LLBLGen Pro sourcecode archive.

The CliSyncWithDatabase tool requires access to most of the LLBLGen Pro designer assemblies and the license file. It's therefore recommended, if you compile the tool from sourcecode, to place it in the LLBLGen Pro installation folder.


CliSyncWithDatabase works the same as using the 'Sync with a database' task on the designer's Sync tab and the same rules apply: a catalog/schema which sync source is set to 'Mixed', will not have its tables refreshed from the database, nor will it have its tables synced with the model: the CliSyncWithDatabase only syncs a project with relational model data from a database.

Other aspects of CliSyncWithDatabase:

  • Preferences will be read from the active user's LLBLGen Pro preferences file.
  • The CliSyncWithDatabase tool is capable of refreshing all meta-data that's also refreshed in the designer.
  • It won't perform a validation of the project, as the designer won't do that either prior to a sync task
  • It will create a backup of the project prior to refreshing the meta-data.
  • It supports one database per run. If you want to sync a project with multiple databases, you have to run CliSyncWithDatabase multiple times.
  • CliSyncWithDatabase will obtain meta-data for all elements found of the same type in the current targeted catalogs/schemas, if at least one element of that type is in the relational model data to sync with. Example: if the relational model data to sync with contains a schema S with 4 tables and 1 view, the tool will retrieve all tables and all views from schema S. UDTs (SQL Server) and sequences/synonyms are always read from the targeted schemas. If the database type supports catalogs, all schemas currently present in the relational model data for that catalog are read. All catalogs in the project of the database type to sync with are read.
  • Running CliSyncWithDatabase requires a valid license present in the folder the executable is started from.

CliSyncWithDatabase usage

To refresh relational meta-data for a database, use the CliSyncWithDatabase with the following command arguments:

  1. CliSyncWithDatabase /u:username /p:password DBType ShowErrorLog ProjectFile
  2. CliSyncWithDatabase /u:username /p:password ShowErrorLog ProjectFile
  3. CliSyncWithDatabase DBType ShowErrorLog ProjectFile
  4. CliSyncWithDatabase ShowErrorLog ProjectFile

Usage 3 and 4: credentials to connect are obtained from the project file. Usage 2 and 4: the relational model data of the first database type found in the project with sync source set to Mixed or Database will be synced.

DBType is a numeric value and can be one of the following:

1 (for MS Access)
2 (for IBM DB2)
3 (for Firebird)
4 (for MySQL)
5 (for Oracle (MS Oracle ADO.NET Provider)
6 (for Oracle (ODP.NET ADO.NET provider)
7 (for PostgreSql)
8 (for SQL Server)

ShowErrorLog is a numeric value and can be 0 or 1. If specified as 1, it will produce the error log of the relational model data retrieval onto stdout.

Usage examples:

CliSyncWithDatabase 8 0 c:\myprojects\myproject.llblgenproj
CliSyncWithDatabase /u:sa /p:topsecret 8 1 c:\projects\mytickettofortune.llblgenproj