PolarPlus is an Oracle-compatible client for PolarDB.
Download the client
PolarPlus is provided as a compressed package and does not require installation. To use it on Linux, download and decompress the package. The directory structure of the decompressed folder is shown below. The polarplus file is the executable file. If you add the path of the polarplus_release/ directory to the system PATH, you can run the polarplus command.
polarplus_release
├── polarplus -> ./polarplus.sh
├── polarplus.sh
├── polarplus.jar
├── login.sql
├── etc
│ └── sysconfig
├── help
└── libPolarPlus usage instructions
Introduction
PolarPlus is a command-line user interface utility for PolarDB. It supports SQL commands, PolarPlus commands, PL/SQL anonymous blocks, functions, and stored procedures. The tool provides the following features:
Query specific database objects.
Execute stored procedures.
Format the output of SQL commands.
Execute batch scripts.
Execute operating system commands.
Record output.
Differences from native tools
PolarPlus is designed for PolarDB and supports the common features of the Oracle SQLPlus tool.
You can use PolarDB-Tools to manage PolarDB clusters. This toolset is designed for PolarDB for PostgreSQL (Compatible with Oracle). The psql tool provided in the toolset supports PL/SQL anonymous blocks, functions, and stored procedures that use Oracle syntax.
Configure PolarPlus
The PolarPlus tool has the following dependencies:
Java Development Kit (JDK) 1.8 environment (x64).
OpenSSL version 1.1 (x64).
Use the
wgetcommand to download and decompress PolarPlus. For the download link, see Download the client.Open the
polarplus.shfile.Modify
export base="{pwd}/polarplus"and replace{pwd}with the absolute path of thepolarplusdirectory.Use the following command on the server to invoke PolarPlus:
polarplus [ -S[ILENT ] ] [ login | /NOLOG ] [ @scriptfile[.ext ] ]Parameter
Description
-S[ILENT ]
If specified, this parameter suppresses the PolarPlus logon banner and all prompts.
login
The logon information used to connect to the database server and database.
The logon information uses the following format:
username[/password][@{connectstring | variable } ]For more information, see Logon information.
variable is a variable defined in the login.sql file. This file contains the database connection string.
/NOLOG
If you start PolarPlus with
/NOLOGspecified, a database connection is not established when PolarPlus starts. Do not use this mode to connect to a database to use SQL commands or PolarPlus commands.NoteAfter starting PolarPlus with the /NOLOG option, you can use the CONNECT command to connect to a database.
scriptfile[.ext ]
scriptfile is the name of a file in the current working directory. The file contains SQL commands and PolarPlus commands that are automatically executed after PolarPlus starts.
.extis the file name extension. If the file name extension is sql, you can omit the.sqlextension when you specify the script file. Name the script file with an extension when you create it. Otherwise, PolarPlus cannot access the file.NotePolarPlus always uses the
.sqlextension for file names that do not have an extension specified.Table 1. Logon information
Parameter
Description
username
The database username used to connect to the database.
password
The password associated with the specified username.
connectstring
A database connection string with the following format:
host[:port][/dbname][?ssl={true | false}]host is the hostname or IP address of the database server.
NoteIf
connectstring,variable, orNOLOGis not specified, the default host is the local host.If you connect using an IPv6 address, the IP address must be enclosed in square brackets.
The following is an example of a connection using an IPv6 address:
polarplus polardb/password@[fe80::20c:29ff:fe7c:78b2]:5444/polardbport is the port number that accepts connections on the database server.
NoteIf not specified, the default value is 5444.
dbname is the name of the database to connect to.
NoteIf not specified, the default value is polardb.
If an SSL connection is required, include the
?ssl=trueparameter in the connection string. The connection string must containhost:port. If the SSL parameter is not specified, the default value is false.
The following is a connection example:
polarplus polardb/password@pc-bp1zxxxxxxxxxxx.o.polardb.rds.aliyuncs.com:1521/polardbNotePolarPlus is used to connect only to version 1.0 of PolarDB for PostgreSQL (Compatible with Oracle). To connect to version 2.0 of PolarDB for PostgreSQL (Compatible with Oracle), download PolarPlus2. Its directory structure and usage are similar to those of PolarPlus. Simply replace
polarpluswithpolarplus2in directories and commands.