Skip to main content
Skip table of contents

CData Virtuality Command Line Client (DSQL)

DSQL is a command-line tool that can be used on both Windows and Linux. The batch/bash file is located in the %dvserver%/bin folder.

The tool is designed to run scripts from files; however, running single requests directly from the command line is also possible. Query results can be either shown on the screen or saved in a file.

Syntax

The command syntax differs for Windows and Linux.

Windows

BASH
dsql.bat "username=<username>" "password=<password>" "host=<host>" "port=<port>" "vdb=<vdb>" "ssl=<ssl>" "maxlines=<maxlines>" "sourcefile=<sourcefile>" "output=<output>" "outfilename=<outfilename>" "query=<query>"

Linux

BASH
./dsql.sh --username <username> --password <password> --host <host> --port <port> --vdb <vdb> --ssl <ssl> --maxlines <maxlines> --output <output> --outfilename <outfilename> [QUERY]
BASH
./dsql.sh -u <username> -p <password> -h <host> --port <port> --vdb <vdb> --ssl <ssl> --maxlines <maxlines> --output <output> --outfilename <outfilename> [QUERY]

Properties

Mandatory

PropertyDescription

username

User name used to connect to the server

password

User password

Optional

PropertyDescription
hostHost to connect to. Default: 127.0.0.1
portPort to connect to. Default: 31000 if the ssl parameter is set to FALSE and 31001 if it is set to TRUE
vdbVirtual database (VDB) in which the query/script should be run
sslSpecifies whether SSL should be used to connect to the server. Default: FALSE
maxlinesMaximum number of lines printed as a result of the execution of a query/script. Default: 20. To set it as unlimited, use -1
sourcefileFile with the SQL script to be executed. This parameter cannot be set if a query is passed as an argument
outputSpecifies where to print out the results, if any. Current options are: screen, CSV (prints to a file). Default: screen
outfilenameFile path and name in case the output is sent to a file

Usage Examples

Windows

1. Running a simple query on the default host and port:

BASH
dsql.bat "username=user1" "password=password1" "query=select 1 ;;"

2. Running a query specifying host and port:

BASH
dsql.bat "username=user1" "password=password1" "host=localhost" "port=31000" "query=select 1 ;;"

3. Running a script from a file and storing the result in another file:

BASH
dsql.bat "username=user1" "password=password1" "output=csv" "outfilename=d:\outfilename.txt" "sourcefile=d:\sourcefile.sql"

Linux

1. Running a simple query on the default host and port:

BASH
./dsql.sh --username user1 --password password1 "select 1 ;;"

2. Running a query specifying host and port:

BASH
./dsql.sh --username user1 --password password1 --host localhost --port 31000 "select 1 ;;"

3. Running a script from a file and storing the result in another file:

BASH
./dsql.sh --username user1 --password password1 --output csv --outfilename outfilename.csv --sourcefile sourcefile.sql

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.