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
- 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.
- Go to the bin directory.
- Open the
polarplus.sh
file.
- Replace
{pwd}
in export base="{pwd}/polarplus"
with the absolute path of the polarplus
file.
- 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 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