You are on page 1of 2

2023-04-20 2501339

2501339 - Error: "SAP DBTech JDBC: Cannot connect to


jdbc..." occurs when connecting tenant DB by using
JDBC driver
SAP Knowledge Base
Version 5 Type
Article
Master
Language English English
Language
Release
Released to Customer Category How To
Status
HAN-DB-CLI (SAP HANA Clients (JDBC,
Component Released On 03.06.2020
ODBC))

Please find the original document at https://launchpad.support.sap.com/#/notes/2501339

Symptom

Error: "SAP DBTech JDBC: Cannot connect to jdbc:sap://<HOSTNAME>:<Port> [Cannot connect to host
<HOSTNAME>:<Port> [Connection refused: connect], -813.].

Environment

• Application uses JDBC driver to connect tenant DB in HANA


• HANA Multitenant Database Containers

Reproducing the Issue

Connect HANA MDC with URL: jdbc:sap://<HOSTNAME>:3<instance number>XX

Cause

Using an invalid port number. Should use the proper port number for tenant DB.

Resolution

1. You can determine the ports used by a particular tenant database by querying the M_SERVICES
system view, either from the tenant database itself or from the system database.

From the 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'))

From the system database: Exchange the <DBNAME> to your tenant DB SID in the following SQL.

SELECT DATABASE_NAME, SERVICE_NAME, PORT, SQL_PORT, (PORT + 2) HTTP_PORT FROM SYS_DATABASES.M_SERVICES


WHERE DATABASE_NAME='<DBNAME>' and ((SERVICE_NAME='indexserver' and COORDINATOR_TYPE= 'MASTER') or
(SERVICE_NAME='xsengine'))

2. Using the result of SQL_PORT as the port number for JDBC connection.

© 2023 SAP SE or an SAP affiliate company. All rights reserved 1 of 2


2023-04-20 2501339

See Also

SAP HANA Administration Guide - Connections for Multitenant Database Containers

2360328 - How to remote connect a tenant database

2101244 - FAQ: SAP HANA Multitenant Database Containers (MDC)

Keywords

813, 30015, Multitenant Database Containers, JDBC

Products

SAP HANA 1.0, platform edition


SAP HANA, platform edition 2.0

This document refers to

SAP Note/KBA Title

2360328 How to remote connect a tenant database

2101244 FAQ: SAP HANA Multitenant Database Containers (MDC)

Terms of use | Copyright | Trademark | Legal Disclosure | Privacy

© 2023 SAP SE or an SAP affiliate company. All rights reserved 2 of 2

You might also like