Using EDB*PlusΒΆ
To open an EDB*Plus command line, navigate through the Applications or
Start menu to the Advanced Server menu, to the Run SQL Command Line
menu, and select the EDB*Plus option. You can also invoke EDB*Plus from
the operating system command line with the following command:
edbplus [ -S[ILENT ] ] [ <login> | NOLOG ] [ @<scriptfile> [.<ext> ] ] -SILENT
If specified, the EDB*Plus sign-on banner is suppressed along with all prompts.
login
Login information for connecting to the database server and database.
login takes the following form; please note that there must be no white space within
the login information:
<username>[/<password>][@{<connectstring> | <variable> } ]Where:
usernameis a database username with which to connect to the database.passwordis the password associated with the specified username. If a password is not provided, but a password is required for authentication, a password file is used if available. If there is no password file or no entry in the password file with the matching connection parameters, then EDB*Plus will prompt for the password.connectstringis the database connection string with the following format:<host> [:<port>][/ <dbname>][?ssl={true | false}]Where:
hostis the hostname or IP address on which the database server resides. If neither @connectstringnor @variablenor/NOLOGis specified, the default host is assumed to be the localhost.portis the port number receiving connections on the database server. If not specified, the default is5444.dbnameis the name of the database to connect to. If not specified the default isedb.If
Internet Protocol version 6(IPv6) is used for the connection instead of IPv4, then the IP address must be enclosed within square brackets (that is, [ipv6_address]). The following is an example that includes an IPv6 connection:
edbplus.sh enterprisedb/password@[fe80::20c:29ff:fe7c:78b2]:5444/edbThe
pg_hba.conffile for the database server must contain an appropriate entry for the IPv6 connection. The following example shows an entry that allows all addresses:
# TYPE DATABASE USER ADDRESS METHOD
host all all ::0/0 md5
For more information about the pg_hba.conf file, see the PostgreSQL core documentation at:
If an SSL connection is desired, then include the
?ssl=trueparameter in the connection string. In such a case, the connection string must minimally include host:port, with or without /dbname. If the ssl parameter is not specified, the default isfalse. See Section 2.3 for instructions on setting up an SSL connection.
variableis a variable defined in thelogin.sqlfile that contains a database connection string. Thelogin.sqlfile can be found in theedbplussubdirectory of the Advanced Server home directory.
/NOLOG
Specify /NOLOG to start EDB*Plus without establishing a database
connection. SQL commands and EDB*Plus commands that require a database
connection cannot be used in this mode. The CONNECT command can be
subsequently given to connect to a database after starting EDB*Plus with
the /NOLOG option.
scriptfile\ [.<ext> ]
scriptfile is the name of a file residing in the current working
directory, containing SQL and/or EDB*Plus commands that will be
automatically executed after startup of EDB*Plus. ext is the filename
extension. If the filename extension is sql, then the .sql extension may
be omitted when specifying scriptfile. When creating a script file,
always name the file with an extension, otherwise it will not be
accessible by EDB*Plus. (EDB*Plus will always assume a .sql extension on
filenames that are specified with no extension.)
The following example shows user enterprisedb with password password,
connecting to database edb running on a database server on the localhost
at port 5444.
C:\Program Files\edb\as13\edbplus>edbplus enterprisedb/password
Connected to EnterpriseDB 13.0.1 (localhost:5444/edb) AS enterprisedb
EDB*Plus: Release 13 (Build 38.0.0)
Copyright (c) 2008-2017, EnterpriseDB Corporation. All rights reserved.
SQL>
The following example shows user enterprisedb with password, password,
connecting to database edb running on a database server on the localhost
at port 5445.
C:\Program Files\edb\as13\edbplus>edbplus enterprisedb/password@localhost:5445/edb
Connected to EnterpriseDB 13.0.1 (localhost:5445/edb) AS enterprisedb
EDB*Plus: Release 13 (Build 38.0.0)
Copyright (c) 2008-2017, EnterpriseDB Corporation. All rights reserved.
SQL>
The following example demonstrates using variable hr_5445 in the login.sql file,
and connecting to database hr on localhost at port 5445.
C:\Program Files\edb\as13\edbplus>edbplus enterprisedb/password@hr_5445
Connected to EnterpriseDB 13.0.1 (localhost:5445/hr) AS enterprisedb
EDB*Plus: Release 13 (Build 38.0.0)
Copyright (c) 2008-2017, EnterpriseDB Corporation. All rights reserved.
SQL>
The following is the content of the login.sql file used in the previous
example.
define edb="localhost:5445/edb"
define hr_5445="localhost:5445/hr"
- The following example executes a script file,
dept_query.sqlafter connecting to database
edbon serverlocalhostat port5444.
C:\Program Files\edb\as13\edbplus>edbplus enterprisedb/password @dept_query
Connected to EnterpriseDB 13.0.1 (localhost:5444/edb) AS enterprisedb
SQL> SELECT * FROM dept;
DEPTNO DNAME LOC
------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> EXIT
Disconnected from EnterpriseDB Database.
The following is the content of file dept_query.sql used in the previous
example.
SET PAGESIZE 9999
SET ECHO ON
SELECT * FROM dept;
EXIT