EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB11193: How to use the command-line MicroStrategy ODBC Test Tool


Community Admin

• Strategy


The following knowledge base article documents the MicroStrategy ODBC Test tool.

Introduction
Strategy Intelligence Server includes a command-line version of the Strategy DB Query Tool.
 
Running the command-line Strategy ODBC Test Tool
The command-line Strategy ODBC Test Tool can be accessed by running the mstrtodbcx script:

  1. From a Unix command prompt, go to the bin folder within the Strategy Home directory:
    
    cd <MSTR Home>/bin

     
    where <MSTR Home> is the Strategy Home Path. The Strategy Home Path is specified during installation.
     
  2. Run the following mstrtodbcx script:
     
    
    ./mstrtodbcx

 
Additionally, on Windows this tool can be accessed by following these steps:

  • Navigate to Program Files(x86)\Common Files\Strategy
  • Launch todbcx.exe

As will be seen in the following sections, all commands in the command-line Strategy ODBC Test Tool, besides SQL queries, begin with a period (.).
 
Connecting to a database
From within the command-line Strategy ODBC Test Tool, use the .connect command to connect to a database. The syntax of the .connect command is as follows:
 


.connect -d <DSN> -u <UserName> -p <Password>

 
For example, if the DSN is "TutorialWH", the username is "tester", and the password is "mypwd", then enter the command:
 

.connect -d TutorialWH -u tester -p mypwd

 

Running a SQL query
Once connected to a database, a SQL query can be run by typing the SQL within the command-line Strategy ODBC Test Tool. The SQL query can be entered in multiple lines. The end of the SQL query is designated by a semicolon. All lines up to a final semicolon will be sent to the database. For example:
 

SELECT * FROM MyDBTable;

 

Disconnecting from the database
Use the .disconnect command to close the current ODBC connection.
 

.disconnect

 

Exiting the Strategy ODBC Test Tool
To exit the Strategy ODBC Test Tool, use the .exit, .bye, or .quit command:
 

.exit

 

Help information
Additional help information and a list of other supported commands can be obtained by running the .help command from within the Strategy ODBC Test Tool:
 

.help

 
Available commands
 

.connect -d <DSN> ]

.cn -d <DSN> ]

 
Disconnects any existing connection and connects to the specified DSN using the username/password authentication. The connection uses exclusively the Strategy DBClasses. The -a argument specifies the alias for the connection. If no alias is specified, then the DSN is used.
 

.listtables

.lt

 
When the ODBC driver supports this functionality, this command lists all the tables corresponding to the specified search pattern. The -d parameter specifies a pattern search on the database name, the -u parameter specifies a pattern search on the user name and the -t parameter specifies a pattern search on the table name. As in SQL search, the wild character is %. The pattern search on the database name is only available with the ODBC API 3.0.
 

.disconnect

 
Disconnects an open connection. The current connection is closed if the alias is not specified.
 

.use -a <alias>

 
Switches to the specified connection.
 

.listalias

.la

 
Lists all the open connection alias names.
 

.listdsns

.ld

 
Lists all the defined DSNs for the specified DSN type.

  • -a specifies all the DSNs (default).
  • -u specifies all the user DSNs.
  • -s specifies all the system DSNs.

 
 


.set -pagesize=#

 
Sets the number of displayed lines at a time from a query.
 

.run -f <filename>

 
Runs the specified script.
 

.output

 
Using this command, the tool writes the output to the command line and also logs it to the specified file.
 

.echo <text>

 
Outputs the text to the screen (and file, if open).
 

.shell <command>

 
Runs a native OS command. The output cannot be directed to the output file.
 

.connectioninfo

 
Displays basic information regarding the connection.
 

.describecolumns

 
Outputs the description for each column from the last SQL query.

.exit

.bye

.quit

 
Ends the session.

KB11193


Comment

0 comments

Details

Knowledge Article

Published:

May 17, 2017

Last Updated:

November 20, 2018