Hitachi

Hitachi Advanced Database Command Reference


38.2.1 Explanation of the specification format and options

Organization of this subsection

(1) Specification format

adbsql
  [-u authorization-identifier [-p password]]
  [-s [-b]]
  [-V]
  [-d]

(2) Explanation of options

-u authorization-identifier

~<character string>((1 to 100 bytes))

Specifies the authorization identifier to be used to connect to the HADB server. Specify the authorization identifier of an HADB user who has the CONNECT privilege.

For this option, specify an authorization identifier in the range from 1 to 100 bytes. Note that the byte count (1 to 100 bytes) does not include the double quotation marks used to enclose the authorization identifier.

Important

If the character string used as the authorization identifier includes any lowercase letter or a backslash (\), make sure that you check the rules for specifying authorization identifiers. For the rules for specifying authorization identifiers, see 1.4.2 Rules for specifying authorization identifiers and passwords.

-p password

~<character string>((1 to 255 bytes))

Specifies the password for the authorization identifier that is specified in the -u option.

Important

If the password includes a character that has a special meaning in the OS or shell, such as a double quotation mark (") or vertical bar (|), make sure that you check the rules for specifying passwords. For the rules for specifying passwords, see 1.4.2 Rules for specifying authorization identifiers and passwords.

-s

Specifies that the search results of a SELECT statement or of the #GETDATA subcommand of the adbsql command are to be output to standard output in CSV format. If you redirect the search results to a file, you can create an input data file that can be used by the adbimport command.

The following items are output:

  • Search results of SELECT statements and #GETDATA subcommands of the adbsql command

  • Error messages of SELECT statements and #GETDATA subcommands of the adbsql command

The following rules and notes apply:

  • When you specify the -s option, you must also specify the -u and -p options.

  • The -s and -V options are mutually exclusive.

  • When the adbsql command is started with the -s option specified, #SET DISPLAY of the adbsql subcommand cannot be executed.

  • The double quotation mark (") is output as the enclosing character and the comma (,) is output as the delimiter.

  • If a character string has a length of 0, only the enclosing characters are output.

  • No enclosing characters are output for the null value.

  • No SQL statements other than the SELECT statement can be specified.

-b

When you specify the -s option, specify this option as well if you want to output binary data in binary format.

-V

Specifies that not only the execution results of the SQL statement but also the contents of the executed SQL statement are to be output. If an adbsql subcommand is executed, not only the execution results of the adbsql subcommand but also the contents of the executed adbsql subcommand are to be output.

The following shows the difference between when this option is specified and when it is not specified.

Executing an SQL statement from a file (infile) by redirecting

Example 1:

adbsql < infile

In this example, only the execution results of the SQL statement are output to the standard output.

Example 2:

adbsql -V < infile

In this example, the execution results of the SQL statement and the contents of the executed SQL statement are output to the standard output.

Outputting the execution results of an SQL statement to a file (outfile) by redirecting

Example 3:

adbsql > outfile

In this example, only the execution results of the SQL statement are output to the file.

Example 4:

adbsql -V > outfile

In this example, the execution results of the SQL statement and the contents of the executed SQL statement are output to the file.

-d

When scaling of decimal data is 0, specify this option if you want to output execution results with the decimal point omitted.

Example: Output example if the execution result is 10.
  • If the -d option is not specified: 10.

  • If the -d option is specified: 10