dbsql interactive command interpreter
You can use the dbsql command to connect to a Db2® database and run queries from a command line interface.
The dbsql command is based on an IBM® Netezza® command called nzsql. The dbsql command has a similar interface for running queries against Db2 environments.
For information about how to obtain the Db2 support tools, which include the dbsql command, see Db2 support tools overview.
dbsql -d bludb -u mark -pw bluepass
Welcome to dbsql, the IBM dashDB SQL interactive terminal.
Type: \? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
BLUDB.MARK(MARK)=>
The previous and subsequent examples in this topic apply to the Db2 managed service and to IBM Db2 Warehouse if you did not obtain the Db2 support tools (which include the dbsql command) from the Db2 Warehouse image or client container. If you obtained the Db2 support tools from the Db2 Warehouse image or client container, see Db2 support tools overview for information about how to run the examples.
Figure legend | Description |
---|---|
1 | Database name |
2 | Schema name. If you do not specify a schema, the command uses a default schema that matches the name of the database user. |
3 | User name |
4 | Query |
5 | Query result |
You enter the user, database, schema, and password information on the dbsql command line after you begin your dbsql session. The following command shows how to connect to a specific database and schema:
dbsql -d bludb -schema test -u mlee -pw blue
Welcome to dbsql, the IBM dashDB SQL interactive terminal.
Type: \? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
BLUDB.TEST(MLEE)=>
To exit the dbsql command line interpreter, type \q and press Enter.