The port number to be used in the connection string include the instance number which is assigned when a new instance is created.
Note: The default value changed between version 1.0 & 2.0 of SAP HANA, express edition, so here is a quick recap:
- SAP HANA 1.0, express edition, the default the instance number is
00
- SAP HANA 2.0, express edition, the default the instance number is
90
Prior to SAP HANA 1.0, express edition SPS12, there was no concept of Multi Database Container (MDC). It was still possible to create multiple database in a single instance, but not using container isolation.
With this mode, the port number will use the following pattern: 3<instance number>15
, and with the default instance number 00
, the port will be 30015
. To access a specific database, you will use the databasename
in the option parameter.
Since SAP HANA 1.0, express edition SPS12 & SAP HANA 2.0, express edition, the Multi Database Container is the default mode.
This means that any created instance will have a System Database and potentially a series of Tenant Databases.
The System Database (also called SYSTEMDB) can be accessed via the following port: 3<instance number>15
.
However, with your Tenant Databases, the SQL port is assigned dynamically at the creation time and follows a different pattern: 3<instance number><SQL port>
.
You can determine the SQL port to use for a particular tenant database using the M_SERVICES
system view, either from the tenant database itself or from the system database, using the following SQL.
- From the system database:
SELECT
DATABASE_NAME
, SERVICE_NAME
, PORT
, SQL_PORT
, (PORT + 2) HTTP_PORT
FROM
SYS_DATABASES.M_SERVICES
WHERE
(
SERVICE_NAME = 'indexserver'
and COORDINATOR_TYPE = 'MASTER'
)
or SERVICE_NAME = 'xsengine'
;
- From a particular tenant database:
SELECT
SERVICE_NAME
, PORT
, SQL_PORT
, (PORT + 2) HTTP_PORT
FROM
SYS.M_SERVICES
WHERE
(
SERVICE_NAME = 'indexserver'
and COORDINATOR_TYPE = 'MASTER'
)
or SERVICE_NAME = 'xsengine'
;