Connect from Go to SAP HANA
Use the Go driver to connect to an SAP HANA database.
Prerequisites
You have built the Go driver.
Context
The SAP HANA driver for Go supports all of the SQLDBC connection properties.
You can trace Go connections by using SQLDBC tracing.
Procedure
| Connection Type | Command |
|---|---|
| Connection string |
hdb://<user>:<password>@<host>:<port>?<connection-property>=<value>&<connection-property>=<value>&... Replace <user> and <password> with the database user and password, and replace <host>:<port> with the SAP HANA server host and port. hdb://<user>:<password>@<host>:<port> is a valid connection string The <connection-property> names are case sensitive. Connection properties are not required. If a property value contains URL special characters (such as providing the full certificate string as the value for the sslTrustStore connect property), URL encode its value. Use the net/url package to do this in one of two ways:
|
| Tenant database in an MDC system |
hdb://<user>:<password>@<host>:<port>?databaseName=<tenant-db-name> Replace <user> and <password> with the database user and password, and replace <host>:<port> with the SAP HANA server host and port. Replace <tenant-db-name> with the name of the tenant database. |
| hdbuserstore key |
hdb://?key=<keyname> |