SAP HANA Database Client for Go
Go-hdb is a native Go (golang) HANA database driver for Go's sql package. It implements the SAP HANA SQL command network protocol.
For the official SAP HANA client Go support (not this database driver) please see SAP Help Portal.
go get -u github.com/SAP/go-hdb/driver
To build go-hdb you need to have a working Go environment of the latest or second latest Go version.
API documentation and documented examples can be found at https://pkg.go.dev/github.com/SAP/go-hdb/driver.
HANA cloud connection proxy is using SNI which does require a TLS connection. To connect successfully you would need a valid root certificate in pem format (please see SAP Help).
The certificate (DigiCertGlobalRootCA.crt.pem) can be downloaded in 'pem-format' from digicert.
Assuming the HANA cloud 'endpoint' is "something.hanacloud.ondemand.com:443". Then the dsn should look as follows:
"hdb://<USER>:<PASSWORD>@something.hanacloud.ondemand.com:443?TLSServerName=something.hanacloud.ondemand.com&TLSRootCAFile=<PATH TO CERTIFICATE>/DigiCertGlobalRootCA.crt.pem"
or
"hdb://<USER>:<PASSWORD>@something.hanacloud.ondemand.com:443?TLSServerName=something.hanacloud.ondemand.com"
with:
When omitting the TLSRootCAFile, TLS uses the host's root CA set (for more information please see Config RootCAs.
To run the driver integration tests a HANA Database server is required. The test user must have privileges to create database schemas.
Set environment variable GOHDBDSN:
#linux example
export GOHDBDSN="hdb://user:password@host:port"
go test
Using the Go build tag 'unit' only the driver unit tests will be executed (no HANA Database server required):
go test --tags unit
SAP SE or an SAP affiliate company and go-hdb contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.