Skip to main content
Skip to main content

SAP HANA

Doris JDBC Catalog supports connection to the SAP HANA database through the standard JDBC interface. This document describes how to configure a SAP HANA database connection.

Terms and Conditions​

To connect to the SAP HANA database you need

  • SAP HANA 2.0 or higher.

  • JDBC driver for SAP HANA database, you can download the latest or specified version of SAP HANA JDBC driver from Maven repository . It is recommended to use ngdbc version 2.4.51 or above.

  • Doris Network connection between each FE and BE node and the SAP HANA server, default port is 30015.

Connect to SAP HANA​

CREATE CATALOG saphana PROPERTIES (
"type"="jdbc",
"user"="USERNAME",
"password"="PASSWORD",
"jdbc_url" = "jdbc:sap://Hostname:Port/?optionalparameters",
"driver_url" = "ngdbc-2.4.51.jar",
"driver_class" = "com.sap.db.jdbc.Driver"
)
remarks

For more information about the JDBC URL formats and parameters supported by the SAP HANA JDBC driver, see SAP HANA.

Hierarchical mapping​

When mapping SAP HANA, Doris' Database corresponds to a Schema under the specified DataBase ("DATABASE" in the jdbc_url parameter) in SAP HANA. The Table under Doris' Database corresponds to the Tables under Schema in SAP HANA. That is, the mapping relationship is as follows:

DorisSAP HANA
CatalogDatabase
DatabaseSchema
TableTable

Type mapping​

SAP HANA to Doris type mapping​

SAP HANA TypeDoris TypeComment
BOOLEANBOOLEAN
TINYINTTINYINT
SMALLINTSMALLINT
INTERGERINT
BIGINTBIGINT
SMALLDECIMALDECIMAL
DECIMALDECIMAL/STRINGWhich type will be selected based on the (precision, scale) of the Doris DECIMAL field
REALFLOAT
DOUBLEDOUBLE
DATEDATE
TIMESTRING
TIMESTAMPDATETIME
SECONDDATEDATETIME
VARCHARSTRING
NVARCHARSTRING
ALPHANUMSTRING
SHORTTEXTSTRING
CHARCHAR
NCHARCHAR

Query optimization​

Statistics​

Doris maintains table statistics in the Catalog so that it can better optimize query plans when executing queries.

See external-statistics to learn how to collect statistics.

Predicate pushdown​

When executing a query like where dt = '2022-01-01', Doris can push these filtering conditions down to the external data source, thereby directly excluding data that does not meet the conditions at the data source level, reducing inaccuracies. Necessary data acquisition and transmission. This greatly improves query performance while also reducing the load on external data sources.

Row limit​

If you have the limit keyword in the query, Doris will push the limit down to the SAP HANA database to reduce the amount of data transfer.

Escape characters​

Doris will automatically add the escape character ("") to the field names and table names in the query statements sent to SAP HANA to avoid conflicts between the field names and table names and SAP HANA internal keywords.