Command Line Using

In Database Tour Pro, the most important operations like exporting data, executing queries, and so on can be performed using the command line. In the command line mode, it is possible to work with all options which are available in GUI.

Sometimes, the command line has very large number of options, which is inconvenient to work with. As an alternative, all the options can be put into one action file. Action files can be executed either from the command line or from GUI. Save your often used database operations to different action files and execute them whenever you need.

Both the command line and action file can include environment variables. That improves the flexibility and gives an ability to reuse the code.

Examples of Command Lines

Data Exporting

Export one table from an MDB file to HTML

dbtour.exe /export /SrcDBPassword=leo12 "/SrcDB=c:\my db\stores.mdb" "/SrcTableName=price" "/TrgDB=c:\my db\price.html"

Export all tables from ACCDB file to XLSX files in silent mode

dbtour.exe /silent /export /SrcDBPassword=leo12 "/SrcDB=c:\my db\stores.accdb" "/SrcTableName=*" "/TrgDB=c:\my db\" "/TrgTableName=*.xlsx"

Export a list of tables from PostgreSQL to Access database. The list of source-to-target table mappings is specified in the separate file. The target database file must exist.

dbtour.exe
/export /ExportType=DATABASE /ExportMode=REPLACE+INSERT /MemorySaving /UseSQLParameters /TrimTrailingSpaces /OpenTarget "/TableMappingsFile=C:\Access Databases\TableMappings-Daily-Export.xml" /SrcDBInterface=firedac /SrcDBKind=DSN /SrcDBDriver=POSTGRESQL /SrcServer=dwh.databasetour.com /SrcPort=5432 /SrcDBUserName=dwh /SrcDBPassword=ght76_LP@ /TrgDBInterface=ado /TrgDBKind=FILE "/TrgDBDriver=Microsoft Access" "/TrgDB=C:\Access Databases\dwh_extract.mdb"

Export data using an action file

dbtour.exe "/ActionFile=c:\My Action Files\export-postgres-to-firebird.txt"

Batch Operations with Text Data

Replacing text in Access table

dbtour.exe /FieldUtils /CloseWhenDone /CloseOnError /DBInterface=ADO /DBDriver=ACCESS /DB=c:\MyData\Genealogy.mdb /TableName=ADDR /fields=Address1 "/ReplaceText=Mark Tweine street," "/ReplaceText=Mark Tweine str.," /ReplaceIgnoreCase

Opening Databases, SQL Scripts, Report Files

Open a folder based DBF database and open a dBase table in it

dbtour.exe /opendb /DBInterface=ADO /DBDriver=dBase /DBKind=FOLDER "/DB=c:\MyData" "/TableName=customer.dbf"

Open an Interbase database, execute an SQL script in it, and then close all

dbtour.exe /opendb /CloseWhenDone /DBInterface=INTERBASE /DBDriver=INTERBASE /DBKind=FILE "/DB=MyServerName:D:\CommonData\News.gdb " /DBUserName=JohnM /DBPassword=qazwsx78 /SQLFile=d:\MyScripts\CheckData.sql /ExecuteQuery

Building Command Lines

The great advantage of this tool is that the command line or action file can be easily built automatically from the GUI using the interface very similar to GUI interface of the corresponding operation:

Generating a command line for exporting data:

Build a Command Line for Exporting Data from GUI

Generating a command line for batch operations with text fields:

Build a Command Line from GUI

More Screenshots...

For more details about the command line parameters, please see Database Tour documentation:

Command Line Usage

Action File