8.14. The query Command

Table 8.15. query Common Options

-conf PATHConfiguration file that contains values for connection properties (url, user and password)
-file PATHFile containing the SQL commands to run. If missing, read SQL commands from STDIN
-passwordPrompt for password
-url JDBCURLJDBC url of the database to connect to
-user USERUser used to connect to the database

The query command line tool can be used to issue SQL statements against a database.

The queries can either be entered via STDIN, or read in from a text file

The following example shows a SELECT statement issued via STDIN

shell> query -url "jdbc:mysql:thin://db2:13306/" -user tungsten -password
Enter password: ********
select * from tungsten_nyc.trep_commit_seqno;

		"statement":"select * from tungsten_nyc.trep_commit_seqno;","rc":0,"results":
			 "update_timestamp":"2019-06-28 10:44:20.0",
			 "extract_timestamp":"2019-06-28 10:44:19.0"