Database Tour Documentation Contents Index

Command Line Usage: Open a Database

Top Previous Next

This topic describes parameters of Database Tour command line, specific to opening a database and performing some additional tasks in it. This type of command line can be used only in Database Tour Pro.

Common rules for writing command lines are described here.

Before you start...

Advanced users can build the needed command line manually using the specification below. But if you are a beginner or just need to create a command line for simple operation, you can save your time using Database Tour command line builder. To generate a command line, choose 'Tools | Generate Command Line | Open a Database...' menu. In 'Generate Command Line' window, specify needed options and click OK. A new window will appear with the command line generated. Copy it, correct it if it is needed, and use in Database Tour calls from your own programs, .bat files etc.

Please note that the command line builder cannot generate any type of command line. It produces only generic command lines which is enough for the most of needs and good point to start from. Generated command line can be easily changed manually for more complex tasks.

Usage

Command line options and their descriptions

Examples

Usage

Classic command line format.

The command line consists of all needed switches and parameters:

dbtour.exe /Parameter1 /Parameter2 /... /ParameterN

Short format.

This format is more flexible as it allows you to keep all command line parameters in a separate action file. The command line consists of the /ParamsFile parameter (which points to the action file path) and an optional /silent parameter:

dbtour.exe [/silent] /ParamsFile=ActionFileName

Command line options and their descriptions

</OpenDB>

Tells the program to open certain database and (optionally) perform some actions in it.

[/silent]

This switch will run the program in 'silent' mode, without any windows (except purchase reminder when the program is used without registration after the end of the test period). When using /ParamsFile option, /silent switch must be outside parameters file. Attention! There are no overwrite or other prompts in this mode.

[/ParamsFile=Value]

Specifies the name of the action file, which contains command line parameters, one parameter per line. Lines with a semicolon at the beginning are ignored as comments. Blank lines are allowed. When using this option, there should not be other command line parameters in the command line except /silent switch. If the file name includes spaces, entire parameter must be enclosed in quotes. See example 10.

[/UseParadoxPasswords]

Semicolon separated list of passwords for Paradox tables (if password protected Paradox tables will be used during the process). Can be used only with /DBInterface=BDE option.

[/DB=Value]

Specifies name of source database to open. This can be a file name, folder name, ODBC DSN, BDE alias name, or connection string. If the name includes spaces, entire parameter must be enclosed in quotes. If the name is an ADO connection string with quotes inside, it is recommended to use the short format of command line.

[/DBInterface=Value]

Specifies database interface (database engine) used to connect the source database. Possible values: ADO, FIREDAC, INTERBASE, BDE. Default value: ADO.

[/DBKind=Value]

Specifies source database kind. Possible values: FOLDER, FILE, DSN, CONSTR; the last one must be used only for ADO interface (see /DBInterface description). If not specified, the program will try to detect it automatically.

Instead of using this parameter, it is possible to use a prefix specifying the database kind (file, folder, ODBC DSN, connection string) in the /DB parameter. The prefix must be enclosed in arrow brackets <>. Possible values: <FILE>, <FOLDER>, <DSN>, <CONSTR>. It is recommended to enclose the entire parameter in quotes in such cases. See example 9.

[/DBDriver=Value]

Specifies source database driver (or database type). Examples of possible values: ACCESS, DBASE, INTERBASE, FIREBIRD, ORACLE, SQL SERVER, etc. If not specified, the program will try to detect it automatically. If the driver name includes spaces, entire parameter must be enclosed in quotes.

[/DBUserName=Value]

Specifies user name for source database. If the user name includes spaces, entire parameter must be enclosed in quotes.

[/DBPassword=Value]

Specifies password for source database. If the password includes spaces, entire parameter must be enclosed in quotes.

[/Server=Value]

Specifies the server address for DB2, SQL Server, Advantage, Informix, Interbase, Firebird, MySQL, PostgreSQL, SQL Anywhere databases. Can be used only with /DBInterface=FireDAC option.

[/Port=Value]

The TCP/IP port on which the DB2, Advantage, PostgreSQL, MySQL, Interbase, or Firebird database server is listening. Can be used only with /DBInterface=FireDAC option.

[/Protocol=Value]

Specifies the protocol used to connect to the DB2, Firebird, or Interbase database server. Can be used only with /DBInterface=FireDAC option.

[/OSAuthentication]

Tells the program to use OS authentication instead of database authentification. Can be used only with /DBInterface=FireDAC option.

[/AutenticationMode=Value]

Specifies authentication mode for Oracle databases. Possible values: Normal, SysDBA, SysOper, etc. Read Oracle documentation for more information. Can be used only with /DBInterface=FireDAC option.

[/VendorLibrary=Value]

Path to the client library of the database vendor. Can be used only with /DBInterface=FireDAC option.

[/VendorHomepath=Value]

Path to the client home directory of the database vendor. Can be used only with /DBInterface=FireDAC option.

[/SystemDB=Value]

Specifies the path to the system database file for Access databases. Can be used only with /DBInterface=FireDAC option.

[/ReadOnly]

Tells the program to open Access database in read-only mode. Can be used only with /DBInterface=FireDAC option.

[/TableName=Value]

Specifies a source table name to open. If this parameter is omitted and the source database is file, the program will try to extract it from /DB. This parameter should not be used with /silent switch. If the name includes spaces, entire parameter must be enclosed in quotes.

[/SQLFile=Value]

Specifies a file name to load SQL text from. The file can also be a multi-statement SQL script; in this case different statements must be separated by /SQLStatementSeparator. The SQL query (queries) from the file will not be executed until /ExecuteQuery switch is used. This parameter should not be used with /silent switch. If the name includes spaces, entire parameter must be enclosed in quotes.

[/ExecuteQuery]

Tells the program to execute SQL query (queries) which was loaded from /SQLFile.

[/PrimaryDataset=Value]

If both /TableName and /SQLFile switches are used in one command line, the program will open two pages (tabs): one for the table and another one for the query. This switch tells the program which of them should be active. Possible values: Table, Query.

[/SQLStatementSeparator=Value]

Specifies separator of SQL statements (SQL terminator) if /SQLFile is a multi-statement SQL script. Can be any character or character code, which follows # symbol. There are also predefined separators:
sqlplus, which is usually used in Oracle SQL Plus utility and other Oracle specific tools and utilities; this is a slash (/) on a separate line between two statements;
mssqlgo, which is usually used in SQL Server tools; this is a GO word on a separate line between two statements.
Default value: semicolon (;).

[/SQLParamNames=Value]

Can be used in cases, when /SQLFile contains a parameterized SQL query (or queries). SQL text of parameterized query contains parameter(s) for dynamic replacement; each parameter starts with colon, for example, :ITEMID, :PAYDATE and so on. SQL parameters are processed on database engine or database (for server databases) level. Use this switch to define a list of parameter names, which should be automatically replaced before the query execution. This list must contain parameter names (the colon must be omitted here) separated by %#% character combination. If the switch contains spaces, it should be enclosed in quotes. This switch must be used in conjunction with /SQLParamValues and /SQLParamTypes switches. See examples.

[/SQLParamValues=Value]

List of SQL parameter values separated by %#% character combination. The number of items in the list and their positions must match the ones from /SQLParamNames switch. To pass null value, text of the value should be NULL (in upper case). If the switch contains spaces, it should be enclosed in quotes.

[/SQLParamTypes=Value]

List of SQL parameter types separated by %#% character combination. The number of items in the list and their positions must match the ones from /SQLParamNames switch. Available types: Boolean, Currency, Date, DateTime, Float, Integer, SmallInt, String, Time, Word. The switch should not contain spaces.

[/SQLMacroNames=Value]

Can be used in cases, when /SQLFile contains an SQL query (or queries) with macros. SQL text of such queries contains macro(s) for dynamic replacement; each macro starts with << and ends with >>, for example, <<ITEMID>>, <<PAYDATE>> and so on; unlike parameter, macro does not have a type and is always inserted as text. Use this switch to define a list of macro names, which should be automatically replaced before the query execution. This list must contain macro names (separators << and >> must be omitted here; macro name should contain only alphanumeric characters) separated by %#% character combination. The macros are processed before processing of parameters; therefore it is possible to use macros inside parameters. If the switch contains spaces, it should be enclosed in quotes. This switch must be used in conjunction with /SQLMacroValues switch. See examples.

[/SQLMacroValues=Value]

List of SQL macro values separated by %#% character combination. The number of items in the list and their positions must match the ones from /SQLMacroNames switch. If the switch contains spaces, it should be enclosed in quotes.

[/ReportVarNames=Value]

List of global report variables, which initial values must be overridden. Multiple items must be separated by %#% character combination. If the switch contains spaces, it should be enclosed in quotes. This switch must be used in conjunction with /ReportPreview switch.

[/ReportVarValues=Value]

List of initial values of global report variables. Multiple items must be separated by %#% character combination. The number of items in the list and their positions must match the ones from /ReportVarNames switch. If the switch contains spaces, it should be enclosed in quotes.

[/CloseWhenDone]

Forces the program to close itself after successful query execution. This option is ignored in 'silent' mode where the program is closed automatically anyway.

[/CloseOnError]

Forces the program to close itself when error occurs during the command line execution. This option is ignored in 'silent' mode where the program is closed automatically anyway.

[/minimize]

Program starts in minimized mode. It is restored to normal mode on error or after ending execution (if /CloseWhenDone switch is not used). This option is ignored in 'silent' mode where the program runs without any windows.

[/LogFile=Value]

Specifies the name of the file to write operation log. If the name includes spaces, entire parameter must be enclosed in quotes.

[/AppendLog]

Specifies that log of the operations should be written from the end of the log file with saving the previous file content. If this switch is omitted, existing log file will be fully overwritten.

[/ColDefsFile=Value]

Specifies name of a file with column definitions. The column definitions will be applied only to page of primary dataset (see description of /PrimaryDataset). If the name includes spaces, entire parameter must be enclosed in quotes.

[/ReportTemplateFile=Value]

Specifies name of a file with report template. In this context, the database and dataset definitions from the report template will be ignored, and report template will be applied currently opened primary dataset (see description of /PrimaryDataset). If the name includes spaces, entire parameter must be enclosed in quotes.

[/NoReportBuilder]

Tells the program not to open report builder after the /ReportTemplateFile was loaded (default behavior is to load the report builder).

[/ReportPreview]

Tells the program to open report preview after the /ReportTemplateFile was loaded.

Examples

1. Open a Microsoft Access database and load SQL text from a file
dbtour.exe /opendb "/DB=c:\my db\stores.mdb" "/SQLFile=c:\my db\TodaysPayments.sql"

2. Open a folder based DBF database and open a table in it
dbtour.exe /opendb /DBInterface=ADO /DBDriver=dBase /DBKind=FOLDER "/DB=c:\MyData" "/TableName=customer.dbf"

3. Open a DSN based Oracle database, load an SQL script, and open a table in it
dbtour.exe /opendb /DBInterface=ADO /DBDriver=Oracle /DBKind=DSN "/DB=MyOraDSN" "/TableName=myschema.address_data" /SQLFile=d:\MyScripts\CopyData.sql /PrimaryDataset=Table

4. Open a connection string based Oracle database, execute an SQL script in it, and then close all
dbtour.exe /opendb /DBInterface=ADO /DBDriver=Oracle /DBKind=CONSTR "/DB=Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;" /DBUserName=JohnM /DBPassword=qazwsx78 /SQLFile=d:\MyScripts\CopyData.sql /ExecuteQuery /CloseWhenDone

5. Open an Interbase database, execute an SQL script in it, and then close all
dbtour.exe /opendb /DBInterface=INTERBASE /DBDriver=INTERBASE /DBKind=FILE "/DB=MyServerName:D:\CommonData\News.gdb" /DBUserName=JohnM /DBPassword=qazwsx78 /SQLFile=d:\MyScripts\CheckData.sql /ExecuteQuery /CloseWhenDone

6. Open an Interbase database via ADO, open an SQL query in it, and load a report template
dbtour.exe /opendb /DBInterface=ADO /DBDriver=INTERBASE /DBKind=FILE "/DB=MyServerName:D:\CommonData\News.gdb" /DBUserName=JohnM /DBPassword=qazwsx78 /SQLFile=d:\MyScripts\LastIncome.sql /ExecuteQuery /ReportTemplateFile=d:\MyReports\LastIncome.dtt

7. Open a Paradox table and load column definitions for it
dbtour.exe /opendb /DBInterface=BDE /DBDriver=Paradox /DBKind=FOLDER "/DB=c:\MyData" "/TableName=orders.db" "/ColDefsFile=c:\MyData\orders.dcl

8. Open a connection string based MySQL database
dbtour.exe /opendb /DBInterface=ADO /DBDriver=MySQL /DBKind=CONSTR "/DBUserName=StacyO" "/DB=Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;"

9. Open a DSN based Oracle database, load and execute parameterized SQL script in it, and then close all. When error is occurred, close the database and program. All execution log must be saved to file. Everything should be done in 'silent' mode.
dbtour.exe /silent /opendb /DBInterface=ADO /DBDriver=Oracle "/DB=<DSN>MyOraDSN" /DBUserName=Bohdan2000 /DBPassword=tobein2010 /SQLFile=d:\MyScripts\UpdateProducts.sql /ExecuteQuery /SQLParamNames=PDate%#%PProdCategory%#%PProdChannel /SQLParamTypes=Date%#%Integer%#%String /SQLParamValues=2014-02-02%#%12%#%Direct /CloseWhenDone /CloseOnError /LogFile=d:\out\logs\UpdateProducts.log

10. The same as the previous one but using an action file
dbtour.exe /silent "/ParamsFile=c:\DBTourStartParameters.txt"

The contents of c:\DBTourStartParameters.txt file should be like the following:

;main action
/opendb

;db definition
/SrcDBInterface=ADO
/DBDriver=Oracle
/DB=<DSN>MyOraDSN
/DBUserName=Bohdan2000
/DBPassword=tobein2010

;actions
/SQLFile=d:\MyScripts\UpdateProducts.sql
/ExecuteQuery
/SQLParamNames=PDate%#%PProdCategory%#%PProdChannel
/SQLParamTypes=Date%#%Integer%#%String
/SQLParamValues=2014-02-02%#%12%#%Direct

;options
/CloseWhenDone
/CloseOnError
/LogFile=d:\out\logs\UpdateProducts.log