Skip to main content

SAP HANA

Installation​

TypeORM relies on @sap/hana-client for establishing the database connection:

npm install @sap/hana-client

If you are using TypeORM 0.3.25 or earlier, hdb-pool is also required for managing the pool.

Data Source Options​

See Data Source Options for the common data source options.

  • host - The hostname of the SAP HANA server. For example, "localhost".
  • port - The port number of the SAP HANA server. For example, 30015.
  • username - The username to connect to the SAP HANA server. For example, "SYSTEM".
  • password - The password to connect to the SAP HANA server. For example, "password".
  • database - The name of the database to connect to. For example, "HXE".
  • encrypt - Whether to encrypt the connection. For example, true.
  • sslValidateCertificate - Whether to validate the SSL certificate. For example, true.
  • key, cert and ca - Private key, public certificate and certificate authority for the encrypted connection.
  • pool — Connection pool configuration object:
    • maxConnectedOrPooled (number) — Max active or idle connections in the pool (default: 10).
    • maxPooledIdleTime (seconds) — Time before an idle connection is closed (default: 30).
    • pingCheck (boolean) — Whether to validate connections before use (default: false).
    • poolCapacity (number) — Maximum number of connections to be kept available (default: no limit).

See the official documentation of SAP HANA Client for more details as well as the extra properties: Node.js Connection Properties.

Column Types​

SAP HANA 2.0 and SAP HANA Cloud support slightly different data types. Check the SAP Help pages for more information:

TypeORM's SapDriver supports tinyint, smallint, integer, bigint, smalldecimal, decimal, real, double, date, time, seconddate, timestamp, boolean, char, nchar, varchar, nvarchar, text, alphanum, shorttext, array, varbinary, blob, clob, nclob, st_geometry, st_point, real_vector and half_vector. Some of these data types have been deprecated or removed in SAP HANA Cloud, and will be converted to the closest available alternative when connected to a Cloud database.

Vector Types​

The real_vector and half_vector data types were introduced in SAP HANA Cloud (2024Q1 and 2025Q2 respectively), and require a supported version of @sap/hana-client as well. By default, the client will return a Buffer in the fvecs/hvecs format, which is more efficient. It is possible to let the driver convert the values to a number[] by adding { extra: { vectorOutputType: "Array" } } to the connection options. Check the SAP HANA Client documentation for more information about REAL_VECTOR or HALF_VECTOR.