PolarPlus is a tool that is used to connect clients to PolarDB databases. PolarPlus is compatible with Oracle syntax.

Download the tool

After you download and decompress the PolarPlus package, you can use PolarPlus. The following code shows the directory structure in which the files extracted from the package are organized:

polarplus
├── bin
├── etc
│   └── sysconfig
├── help
└── lib

All binary files are stored in the bin directory. If you want to use the binary files, add the path of the bin directory to the PATH variable of the system.

bin
├── polarplusLauncher.sh
├── polarplus.sh

Use PolarPlus

PolarPlus is a utility that provides a CLI for PolarDB. PolarPlus supports SQL statements, Stored Procedure Language (SPL) anonymous blocks, and PolarPlus commands.

PolarPlus allows you to perform the following operations:

  • Query specified database objects.
  • Run stored procedures.
  • Format the outputs of SQL statements.
  • Run batch processing scripts.
  • Run OS commands.
  • Record outputs.

To download and configure PolarPlus, perform the following steps:

Note The following items are the prerequisites for PolarPlus:
  • Java Development Kit (JDK) 1.8 for x86-64 OSs
  • OpenSSL 1.1 for x86-64 OSs
  1. In the CLI, run the wget command to download the PolarPlus package. Then, decompress the package. For more information about the download links of PolarPlus, see Download the tool.
  2. Go to the bin directory.
  3. Open the polarplus.sh file.
  4. Replace {pwd} in export base="{pwd}/polarplus" with the absolute path of the polarplus file.
  5. On the server that you want to connect to a PolarDB database, run the following command to start PolarPlus:
    polarplus [ -S[ILENT ] ] [ login | /NOLOG ] [ @scriptfile[.ext ] ]
    Parameter Description
    -S[ILENT ] If you configure this parameter, no logon banner or logon-related message appears when you use PolarPlus to connect to the database.
    login The logon information that is used to connect to the database server and the database.

    The value of this parameter must be specified in the following format:

    username[/password][@{connectstring | variable } ]

    For more information, see Table 1.

    The variable parameter is a variable that is defined in the login.sql file. The login.sql file contains the connection string of the database.

    /NOLOG If you specify this option, no connections to the database are created when you start PolarPlus. If you want to connect to the database to execute SQL statements or run PolarPlus commands, do not specify this option.
    Note If you specify this option when you start PolarPlus and you want to connect to the database, run the CONNECT command.
    scriptfile[.ext ] The scriptfile parameter specifies the name of the file that is stored in the current working directory. This file contains the SQL statements that are automatically executed and the PolarPlus commands that are automatically run after you start PolarPlus.
    .ext specifies the file extension. If the file extension of a script file is .sql, you can omit the file extension when you specify the script file. When you create a script file, name the file in the <File name>.<File extension> format. Otherwise, PolarPlus cannot access the file.
    Note For files that do not contain a file extension suffix in the file name, PolarPlus processes the files as .sql files.
    Table 1. Logon information
    Parameter Description
    username The username that is used to connect to a database.
    password The password that is used to connect to the database.
    connectstring The connection string of the database. The connection string must be specified in the following format:
    host[:port][/dbname][?ssl={true | false}]
    • The host parameter specifies the hostname or the IP address of the database server.
      Note If none of connectstring, variable, and NOLOG are configured, the default host is the on-premises host.
    • If you use an Internet Protocol version 6 (IPv6) address to connect to a database, you must place the IP address in brackets ([]).

      The following example shows how to use an IPv6 address to connect to a database:

      polarplus  polardb/password@[fe80::20c:29ff:fe7c:78b2]:5444/polardb
    • The port parameter specifies the port that is used by the database server to receive connection requests.
      Note If you leave this parameter empty, the default port 5444 is used.
    • The dbname parameter specifies the name of the database to which you want to connect.
      Note If you leave this parameter empty, the default value polardb is used.
    • If you want to create SSL connections, you must specify ?ssl = true and host:port in the connection string. Otherwise, SSL connections cannot be established.

    The following example shows how to use PolarPlus to connect to a PolarDB database:

    polarplus  polardb/password@pc-bp1zxxxxxxxxxxx.o.polardb.rds.aliyuncs.com:1521/polardb