
SAP MaxDB SQLCLI is a command line tool for entering and executing SQL statements, executing database procedures, and querying information about SAP MaxDB databases. You can use SQLCLI interactively or import commands from a file and execute them in the background. You can access databases on your local computer and on remote computers. The SQLCLI command can be used for
• Access data
• Access the database catalog
• Make SQL queries
• Create and manage database objects
• Create and manage database users
Connect to database using SQLCLI
1. Login to your operating system to open the SQL Command Line Interface (SQLCLI). The screen will appear like below.
> sqlcli
Welcome to the MaxDB interactive terminal.
Type: \h for help with commands
\q to quit
sqlcli=>
2. You need to execute command, \c -d DATABASE-NAME -u USERNAME,PASSWORD to be connected to the database.
sqlcli=> \c -d DATABASE-NAME -u USERNAME,PASSWORD Connected to DATABSE-NAME
SQLCLI command options
1. You can execute command \h to list all the available command options for MaxDB.
sqlcli SID=> \h
\? or \h[elp] show help on internal slash commands
\q[uit] quit SQLCLI
\c[onnect] -n <database_server>[:<port>]
-d <database_name>
-u <user_name,password>
connecting to the database
\di[sconnect] disconnecting from the database
\mu[ltiline] [ON|OFF] toggle the multiline mode on or off
\a[utocommit] [ON|OFF] switch autocommit mode on or off
\m[ode] [INTERNAL|ORACLE|ANSI|DB2] change SQL mode
\ps [ON|OFF] toggle the usage of prepared statements on or off
\o[utput] <filename> send all query results to file
\i[nput] <filename> read input from the file <filename>
\p[rint] print out the current query buffer
\r[eset] reset (clear) the query buffer
\e[dit] <filename> edit the query buffer (or file) with external editor
\g send query buffer to server (and print out the results)
\al[ign] [ON|OFF] toggle the aligned output on or off
\pa[ger] [ON|OFF] toggle page by page scroll output on or off
\f[ieldsep] <separator> use <separator> as the field separator
\s[tatus] print out host, database, user etc.
\! <command> execute <command> in shell
\dc [PATTERN] list columns
\de [PATTERN] list indices
\dp [PATTERN] list procedures
\ds [NAME] list schemas
\dt [PATTERN] list tables
\du [NAME] list users
\dv [PATTERN] list views
[PATTERN] = [OWNER.][OBJECT NAME] eg. <username>.%A%
Note:
Please refer to MaxDB user types and classes to determine which user can be use for connection.


