mql Command

MQL is the Matrix Query Language. Similar to SQL, MQL consists of a set of commands that help the administrator build and test a database quickly and efficiently. You can also use MQL to add information to and extract information from the existing database.

This page discusses:

User Level

Business Administrator

Syntax

The command uses this syntax.

mql [options] [-] [file...]

Clauses (Parameters)

Clauses

Options Specifies
-inidir DIRECTORY_PATH Indicates to use alternatie INI files in the defined directory.
-b FILENAME Uses the specified bootstrap file. By default, 3DSpace reads matrix-r as the bootstrap file. The bootfile is expected to be in your ENOVIA_INSTALL directory. For example, suppose you have two databases that you frequently access, a test system (Mx_qtest) and a production system (Mx_production).

You could create two shortcuts on your Windows Start menu. The shortcut for the test database could be called QAmatrix and contain the following:

c:\enoviaV6R2014\studio\bin\winnt\mql.exe -b Mx_qtest 

The shortcut for the production database could be called PRDmatrix and contain the following:

c:\enoviaV6R2014\studio\bin\winnt\mql.exe -b Mx_production

Generally, there is no need to duplicate or move Matrix .ini files. However, if multiple files will be opened for view or edit from a database that is not using the standard matrix-r file, errors will occur.

-c COMMAND Uses the specified command as the input script. Enables you to enter MQL commands from the system command line. This option specifies that the MQL commands enclosed within the double quotes are processed.

For example, the following command assigns new telephone and facsimile numbers to a defined user (Joe) from the system command line:

mql -c "modify person Joe phone 598-4354 FAX 598-4355;" 

You can include more than one MQL command in the command string. In the syntax COMMAND; {COMMAND;} you can include as many commands as you want, providing each command ends with a semicolon and space and all the MQL commands are enclosed within the quotes.

-install OPTION Creates a bootfile to connect to the database (sometimes referred to as a connection file or bootstrap file).

Option Description
-user DBUSER Required. Names the user used to connect to the database. This is the database user that is created to hold the 3DEXPERIENCE Platform database. It is established by the database administrator.
-password DBPASSWORD Required. Defines the security password associated with the Username. This is established by the database administrator. The user password is encrypted as well as encoded.
-host "CONNECTSTRING" Required. Defines the connection string of the database server. The value must be enclosed in double quotes. Use of single quotes or no quotes will fail.
-driver DRIVER Required. Must be one of these values:
  • 'Oracle/OCI80'
  • 'MSSQL/ODBC'
On Windows, the -driver value must not be put in single quotes as this leads to a crash.
-bootfile FILENAME Optional. Include this parameter if you want to name the connection file differently than the default (MATRIX-R). The value is case-sensitive.
-dataspace DATA_TABLESPACE Optional. Defines the default for all vaults and the data tablespaces used for the non-vault tables; that is, the MX tables that are created when the V6 database is initialized. The value is case-sensitive.
-indexspace INDEX_TABLESPACE Optional. Defines the default for all vaults and the index tablespaces used for the non-vault tables; that is, the MX tables that are created when the V6 database is initialized. The value is case-sensitive.
-jdbc Optional. Defines the JDBC URL to connect via jdbc to the database. The value is case-sensitive.
-tablespace TABLESPACE Specifies the default data tablespace. The value is case-sensitive
-casesensitive|caseinsensitive Indicates if the database is case-sensitive or case-insensitive.

-k Specifies that the 3DEXPERIENCE Platform continues on to the next MQL command if an error is detected in an MQL command. An abort-on-error is the default when MQL commands are read from a script or file. An abort happens when you encounter an error and you are returned to the operating system. However, you might not want a script to terminate when an error is found during processing. When this option is specified, an error message is printed when the error is encountered and the script continues to run.
-t Suppresses printing of the opening MQL title. This title identifies the product name, copyright information, and version number. When you use MQL frequently, the -t option saves time since the information is not displayed. This also suppresses the display of the MQL window.
-v This option specifies verbose mode. In this mode, the 3DEXPERIENCE Platform prints all messages generated during startup and the processing of commands. If you do not need this level of detail, you still receive error messages and other important MQL messages without the -v option.
-p Pipe the input and output
-q Quotes are enabled.
-stdout:FILENAME Redirects the output of the command to the specified filename.
-stdin:FILENAME Reads input for the command from the specified filename.
-stderr:FILENAME Redirects MQL errors to the specified filename.
-version Lists the software version and exits the MQL shell.
-remain Runs the commands specified by the -c option and remains in the MQL shell.

Examples

For example, to run an mql script with error files you might add something similar to the following to the MQL target in a Windows shortcut property.

c:\enoviaV6R2014\studio\BIN\winnt\mql -k -t "-stderr:d:\path with spaces\a.err" 
 "d:\path with spaces\mql_script.mql"

Another example:

mql -install -bootfile matrix-NEW -user Scott -password Tiger -driver Oracle/OCI80