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
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
./dsql.sh --username <username> --password <password> --host <host> --port <port> --vdb <vdb> --ssl <ssl> --maxlines <maxlines> --output <output> --outfilename <outfilename> [QUERY]
./dsql.sh -u <username> -p <password> -h <host> --port <port> --vdb <vdb> --ssl <ssl> --maxlines <maxlines> --output <output> --outfilename <outfilename> [QUERY]
Properties
Mandatory
Property | Description |
---|---|
| User name used to connect to the server |
| User password |
Optional
Property | Description |
---|---|
| Host to connect to. Default: |
| Port to connect to. Default: |
| Virtual database (VDB) in which the query/script should be run |
| Specifies whether SSL should be used to connect to the server. Default: |
| Maximum number of lines printed as a result of the execution of a query/script. Default: |
| File with the SQL script to be executed. This parameter cannot be set if a query is passed as an argument |
| Specifies where to print out the results, if any. Current options are: |
| File 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:
dsql.bat "username=user1" "password=password1" "query=select 1 ;;"
2. Running a query specifying host and port:
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:
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:
./dsql.sh --username user1 --password password1 "select 1 ;;"
2. Running a query specifying host and port:
./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:
./dsql.sh --username user1 --password password1 --output csv --outfilename outfilename.csv --sourcefile sourcefile.sql