Languages

Command line interface

DatAdmin has command line interface called DACI. It is used internally when running scheduled jobs, also it can be used by user to do various database tasks (export, backup, copy, syncrhonize database, running saved jobs, generating SQL from databse objects, running SQL against databse)

help command

DACI has inbuilt help command reflecting actual commands and its parameters. While help, which you now read, tries to be a bit informal and ilustrative, DACI help command writes exact information, which is really used.
Run "daci" without parameters to list commands, "daci help <command>" to get help about one command.

Specifying connection in commandline

Connection is specified using these parameters:

  • dbfile - file containing database, data archive (dbk extension) or database structure (ddf extension). Also .con file containing stored connection is accepted. If parameter starts with "data:", file is searched in DatAdmin data directory (files which you see in connection tree).
  • connection - connection string to database, if given, also driver parameter must be defined
  • driver - database driver. List of drivers can be obtained using command "daci list driver"
  • database - database name, if it cancnot be deduced from other parameters.
  • Examples are bellow, with described command

exportdb command

Export databse into DBK or DDF file (data archive or database structure). Accepts parameter outfile.

Examples

  • daci exportdb --dbfile database.db3 --outfile backup.dbk - opens database file database.db3 (must be in SQLite format) and dumps it as data archive to file backup.dbk
  • daci exportdb --dbfile data:mysql-local.con --database test1 --outfile backup.ddf - assumes defined connection mysql-local, dumps structure of database test1 to file backup.ddf

gensql command

Generates SQL from any database object. Accept connection parameters, template specification (what should be dumped) and object name. If not specified outfile parameter, SQL is dumped to standard output.

Parameters

  • connection, dbfile, driver, database - see section about connection in commandline
  • template - SQL template which to use; Use "daci list sqlgenerator" to view possible values. This is main parameter determining type of output query.
  • dialect - Dialect of output SQL scripts, list can be obtained using "daci list dialect"
  • objname, objschema, objtype, subtype - name and type of dumped objects (see following examples).

Examples

  • daci gensql --dbfile data:database.db3 --template create-all --dialect sqlite > test.sql - dumps creation of all database objects (tables, views, indexes...) into file test.sql
  • daci gensql --driver mysql --connection "Data Source=localhost;User ID=root;Password=PASSWORD" --database DBNAME --objname TABLENAME --template recreate-table --dialect mysql > test.sql - dumps recreation of table TABLENAME. Also shows how direct connection using connection string is done.

copydb command

Copies database from one place to other. Source connection parameters are prefixed with "src.", destination with "dst,". Structure and data are copied. Each database can have different database engine.

Examples

  • daci copydb --src.driver mysql --src.connection "Data Source=localhost;User ID=root;Password=PASSWORD" --src.database SRCDB --dst.dbfile OUTPUT.db3 - copies database SRCDB from mysql server at localhost into SQLite database into file OUTPUT.db3
  • daci copydb --src.dbfile: INFILE.dbk --dst.dbfile OUTFILE.db3 - creates SQLite database OUTFILE.db3 from data archive stored in file INFILE.dbk