Pure-Go driver for SAP HANA. No cgo, no client library - one static binary. Speaks the HANA SQL Command Network Protocol directly. Built for database/sql, minimal dependencies. Requires Go latest or second latest version.
cfg := driver.NewConnectorConfig()
cfg.Host, cfg.Username, cfg.Password = "host:port", "user", "password"
connector, err := driver.NewConfigConnector(cfg)
// ... handle err
db := sql.OpenDB(connector)
defer db.Close()
// ...Full runnable example: Example (source).
Looking for SAP's official HANA client for Go? That's here — this is the community driver.
go get github.com/SAP/go-hdb/driverFor HANA Cloud (SNI/TLS), see the cloud connection guide.
Core
database/sqlcompliant,driver.Connectorsupport- TLS, PBKDF2 (default) with user/password fallback
- Auth: LDAP, X.509 client cert, JWT - with refresh callbacks
- Bulk execution, stored procedures with table output parameters
- Little-endian (e.g. amd64) and big-endian (e.g. s390x) architecture support
Data
- UTF-8 to/from CESU-8 for HANA Unicode types
- HANA decimals as:
- LOB streaming, scanning rows into structs (
driver.StructScanner) - LZ4 compression
Observability
- Driver stats via
Connector.NativeDriver().Stats() - Per-DB
ExStats()(requiresdriver.OpenDB) - Prometheus collectors
- Per-statement SQL trace via
slog
For diagnosing latency and tuning throughput, see the performance guide.
- API + examples: pkg.go.dev
- Connector configuration: docs/CONFIG.md
- Compression: driver/compress/README.md
- Changes: RELEASENOTES.md
To run the driver integration tests, a HANA database server is required. The test user must have privileges to create database schemas.
export GOHDBDSN="hdb://user:password@host:port"
go test ./...Unit-only (no server):
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.
This project integrates AI into its development practices; contributors are expected to review and take ownership of all AI-assisted changes. Its design philosophy and development guidelines are documented in AGENTS.md.