Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions tutorials/hana-clients-dot-net-core/hana-clients-dot-net-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,22 @@ dotnet --version

If the `dotnet` command is not recognized, it means that the .NET SDK has not been installed. If the SDK is installed, the command returns the currently installed version, such as 8.0.203.

[OPTION BEGIN [Windows and Mac]]

If the .NET SDK is not installed, download it from [Download .NET](https://dotnet.microsoft.com/download) and run the installer on Microsoft Windows or Mac.

![.NET Core SDK install](dotnet-install.png)

[OPTION END]

[OPTION BEGIN [Linux]]

On Linux, follow the instructions for the appropriate Linux version such as [Install the .NET SDK or the .NET Runtime on openSUSE](https://docs.microsoft.com/en-us/dotnet/core/install/linux-opensuse).

In order for the shell to recognize that the .NET SDK is installed and for any `dotnet` commands in future steps to be recognized, a new shell window needs to be opened.
[OPTION END]

> [!TIP]
> In order for the shell to recognize that the .NET SDK is installed and for any `dotnet` commands in future steps to be recognized, a new shell window needs to be opened.

> [!NOTE]
> For further details on supported versions, see SAP Note 3165810 - SAP HANA Client Supported Platforms.
Expand Down Expand Up @@ -116,7 +125,7 @@ In order for the shell to recognize that the .NET SDK is installed and for any `
{
try
{
using (var conn = new HanaConnection("Server=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.hana.prod-xxxx.hanacloud.ondemand.com:443;UID=User1;PWD=Password1;encrypt=true;sslValidateCertificate=false"))
using (var conn = new HanaConnection("Server=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.hana.prod-xxxx.hanacloud.ondemand.com:443;UID=User1;PWD=Password1;encrypt=true;sslValidateCertificate=false;sessionVariable:APPLICATION=dotNETQuery"))

// encrypt and sslValidateCertificate should be true for HANA Cloud connections
// As of SAP HANA Client 2.6, connections on port 443 enable encryption by default
Expand Down Expand Up @@ -167,6 +176,9 @@ In order for the shell to recognize that the .NET SDK is installed and for any `

Save and close the `Program.cs` file after replacing the code and updating the host and port.

> [!NOTE]
> The `sessionVariable:APPLICATION` parameter sets a custom application name for the connection. This value can be viewed in the `CLIENT_APPLICATION` column of the `M_CONNECTIONS` system view and may also appear in SAP HANA telemetry data.

The above app makes use of some of the SAP HANA client .NET driver methods, such as [HanaConnection](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/d19390d16d6110149af29776dce510bc.html). Connection details for this class can be found at [Microsoft ADO.NET Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/469e137b6d611014ac27bffe40be2f18.html). Further .NET API details can be found in the [.NET API browser](https://docs.microsoft.com/en-us/dotnet/api/?view=net-6.0).

6. Run the app:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ dotnet ef -h
}

protected override void OnConfiguring(DbContextOptionsBuilder options) {
options.UseHana("Server=xxxxxxxx-.hanacloud.ondemand.com:443;UserName=User2;Password=Password2;Current Schema=USER2");
options.UseHana("Server=xxxxxxxx-.hanacloud.ondemand.com:443;UserName=User2;Password=Password2;Current Schema=USER2;sessionVariable:APPLICATION=EFCoreQuery");
}
}

Expand All @@ -159,6 +159,9 @@ dotnet ef -h

Be sure to update the host URL and optionally the user name and password.

> [!NOTE]
> The `sessionVariable:APPLICATION` parameter sets a custom application name for the connection. This value can be viewed in the `CLIENT_APPLICATION` column of the `M_CONNECTIONS` system view and may also appear in SAP HANA telemetry data.

> [!WARNING]
> EnsureDeleted and EnsureCreated will delete and recreate the objects in the schema USER2. As documented at [RelationalDatabaseCreator.EnsureDeleted Method](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.storage.relationaldatabasecreator.ensuredeleted), it will delete all objects in the schema USER2.

Expand Down
57 changes: 44 additions & 13 deletions tutorials/hana-clients-golang/hana-clients-golang.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ If Go is installed, then it will return the currently installed version, such as
> [!NOTE]
> For further details on supported versions, see SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810).

If it is not installed, download it from [Download Go](https://golang.org/dl/), run the installer, follow the provided instructions, and ensure that Go is in your path.
[OPTION BEGIN [Windows and Mac]]

On Linux, follow the instructions for the appropriate Linux version such as the [Installing Go for openSUSE](https://en.opensuse.org/SDB:Go).
If Go is not installed, download it from [Download Go](https://golang.org/dl/), run the installer, follow the provided instructions, and ensure that Go is in your path.

[OPTION END]

[OPTION BEGIN [Linux]]

If Go is not installed, follow the instructions for the appropriate Linux version such as the [Installing Go for openSUSE](https://en.opensuse.org/SDB:Go).

[OPTION END]

> [!TIP]
> In order for the shell to recognize that Go has been installed and for any go commands in future steps to be recognized, a new shell window needs to be opened.
Expand All @@ -61,21 +69,39 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,

![gcc 64-bit](gccLinux.png)

For Windows (if it is not installed), it can be downloaded from [Download MinGW](https://www.mingw-w64.org/downloads/). Under **WinLibs.com**, you can install from [winlibs.com](https://winlibs.com/), by scrolling to the **Download** section and downloading the latest release version (UCRT runtime) of the ZIP archive for Win64 to install for the x86_64 architecture, and then extracting the folder.
[OPTION BEGIN [Windows]]

If `gcc` is not installed, it can be downloaded from [Download MinGW](https://www.mingw-w64.org/downloads/). Under **WinLibs.com**, you can install from [winlibs.com](https://winlibs.com/), by scrolling to the **Download** section and downloading the latest release version (UCRT runtime) of the ZIP archive for Win64 to install for the x86_64 architecture, and then extracting the folder.

![Download minGW from WinLibs](winLibsMinGW.png)

If command prompt isn't showing you the installed version after running the version check command, manually add the bin folder to your path by setting it in your environment variables.

On Windows, search **Edit the System Environment Variables** and click on **Environment Variables...**.
Search **Edit the System Environment Variables** in the Microsoft Windows Start menu and click on **Environment Variables...**

![Edit environment variables](editEnvironmentVariables.png)

Look for the `Path` environment variable and double click to edit. Select **Browse** and manually browse through your File Explorer to find the bin folder.

![Add bin to path](add-bin-to-path.png)

On Linux, install the System GNU C compiler for your version of Linux. Note that if you are using openSUSE, minGW is included in the installation for Go through YaST.
[OPTION END]

[OPTION BEGIN [Linux]]

If `gcc` is not installed, install the system GNU C compiler for your version of Linux. The GNU C compiler includes the `gcc` command required by `cgo`. Note that if you are using openSUSE, MinGW is included in the installation for Go through YaST.

[OPTION END]

[OPTION BEGIN [Mac]]

If `gcc` is not installed, install the Xcode Command Line Tools if they are not already installed. These tools include the compiler and related development tools required by `cgo`.

```Shell
xcode-select --install
```

[OPTION END]

2. Examine the Go environment by running the below command:

Expand All @@ -87,24 +113,24 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,

GOPATH is set to a location such as `C:\Users\user\go` or `$HOME/go` and defines the root of your workspace which stores your codebase.

3. Set the `CGO_LDFLAGS` environment variable to point to the location of the `libdbcapiHDB` library as shown below and set the `LD_LIBRARY_PATH` if needed.
3. Set the `CGO_LDFLAGS` environment variable to point to the location of the `libdbcapiHDB` library as shown below and set the appropriate library path variable if needed.

[OPTION BEGIN [Windows]]

On Windows, add a **NEW** variable. Set the variable name to **`CGO_LDFLAGS`** and the variable value to the location of `dbcapi` library: `C:\SAP\hdbclient\libdbcapiHDB.dll`
Add a **NEW** variable. Set the variable name to **`CGO_LDFLAGS`** and the variable value to the location of `dbcapi` library: `C:\SAP\hdbclient\libdbcapiHDB.dll`

![Set environment variables](setEnvVar.png)

Ensure that the `hdbclient` folder is set in your **Path** environment variable. You can set this path by clicking on **New** and browsing for your `hdbclient` folder.

![hdbclient path environment variable](hdbclient-path.png)

[OPTION BEGIN [Mac and Linux]]

On Linux and Mac, add the corresponding following lines to the `.bash_profile`.

[OPTION END]

[OPTION BEGIN [Linux]]

Add the following lines to the appropriate shell profile for your environment.

```Shell
export CGO_LDFLAGS=$HOME/sap/hdbclient/libdbcapiHDB.so
export LD_LIBRARY_PATH=$HOME/sap/hdbclient
Expand All @@ -114,6 +140,8 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,

[OPTION BEGIN [Mac]]

Add the following lines to the appropriate shell profile for your environment.

```Shell
export CGO_LDFLAGS="$HOME/sap/hdbclient/libdbcapiHDB.dylib"
export DYLD_LIBRARY_PATH="$HOME/sap/hdbclient"
Expand Down Expand Up @@ -187,7 +215,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,
func main() {
//Option 1, retrieve the connection parameters from the hdbuserstore
//host, port, user name and password come from the hdbuserstore key USER1UserKey
connectString := "hdb://?key=USER1UserKey&encrypt=true&sslValidateCertificate=false"
connectString := "hdb://?key=USER1UserKey&encrypt=true&sslValidateCertificate=false&sessionVariable:APPLICATION=goQuery.go"

//Option 2, specify the connection parameters
//connectString := "hdb://User1:Password1@999deec0-ccb7-4a5e-b317-d419e19be648.hana.prod-us10.hanacloud.ondemand.com:443?encrypt=true&sslValidateCertificate=false"
Expand Down Expand Up @@ -229,6 +257,9 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,

Once the `goQuery.go` file has been updated, save and close the file.

> [!NOTE]
> The `sessionVariable:APPLICATION` parameter sets a custom application name for the connection. This value can be viewed in the `CLIENT_APPLICATION` column of the `M_CONNECTIONS` system view and may also appear in SAP HANA telemetry data.

3. Create another go module and modify its contents:

[OPTION BEGIN [Windows]]
Expand Down Expand Up @@ -268,7 +299,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces,
[OPTION BEGIN [Mac and Linux]]

```Code
replace SAP/go-hdb/driver v0.1.0 => /home/name/sap/hdbclient/golang/src/SAP/go-hdb/driver
replace SAP/go-hdb/driver v0.1.0 => $HOME/sap/hdbclient/golang/src/SAP/go-hdb/driver
require SAP/go-hdb/driver v0.1.0
```

Expand Down
12 changes: 5 additions & 7 deletions tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http

- If you are on a Linux or Mac machine and the hdbsql connection fails with the error message below, it indicates that the OpenSSL library could not locate a trust store in the default location.

_Cannot create SSL context: SSL trust store cannot be found: `/Users/user1/.ssl/trust.pem`_
_Cannot create SSL context: SSL trust store cannot be found: `$HOME/.ssl/trust.pem`

A public root certificate to validate the server's certificate is needed. More information about the required DigiCert root certificate can be found at [Secure Communication Between SAP HANA Cloud and JDBC/ODBC Clients](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/secure-communication-between-sap-hana-and-sap-hana-clients) and [3397584 - HANA Cloud Connections will switch from "DigiCert Global Root CA" to "DigiCert TLS RSA4096 Root G5"](https://me.sap.com/notes/3397584).

Expand All @@ -165,10 +165,10 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http

This step creates two users and a schema. `USER1` will be the owner of the tables that will be created in a subsequent step and will be used to connect to the database.

On Linux or a Mac, turn off page by page scroll output. Also, consult the `-j` `hdbsql` option. This enables multiple commands to be pasted at one time and does not require each result to be exited by pressing q.

[OPTION BEGIN [Mac and Linux]]

Turn off page by page scroll output. Also, consult the `-j` `hdbsql` option. This enables multiple commands to be pasted at one time and does not require each result to be exited by pressing q.

```HDBSQL
\pa off
```
Expand Down Expand Up @@ -244,8 +244,6 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff
> [!TIP]
> Uppercase `-U` is for specifying a key from the user store, lower case `-u` is for user.

---

[Using Stored Connection Information](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/708e5fe0e44a4764a1b6b5ea549b88f4.html) contains details on how an application can use a `hdbuserstore` key.

### Create tables and insert data
Expand All @@ -264,10 +262,10 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff

[OPTION END]

Substitute `pico` below for your preferred text editor.

[OPTION BEGIN [Mac and Linux]]

Substitute `pico` below for your preferred text editor.

```Shell
mkdir -p $HOME/HANAClientsTutorial/sql
cd $HOME/HANAClientsTutorial/sql
Expand Down
7 changes: 5 additions & 2 deletions tutorials/hana-clients-jdbc/hana-clients-jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ primary_tag: software-product>sap-hana-cloud

Ensure that you have a Java Development Kit (JDK) installed and ensure that it is accessible from your path. Details on supported versions can be found at SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810).

An OpenJDK from SAP is available at [SapMachine](https://sap.github.io/SapMachine/#download). If you don't already have a JDK installed, please install it from SapMachine.
An OpenJDK from SAP is available at [SapMachine](https://sap.github.io/SapMachine/#download). If you don't already have a JDK installed, you can install it from SapMachine or use your operating system's package manager.

To verify that the JDK is correctly set up, run the following:

Expand Down Expand Up @@ -173,7 +173,7 @@ See [JDBC Command-Line Connection Options](https://help.sap.com/docs/SAP_HANA_CL
connection = DriverManager.getConnection(
//Option 1, retrieve the connection parameters from the hdbuserstore
//The below URL gets the host, port and credentials from the hdbuserstore.
"jdbc:sap://dummy_host:0/?KEY=USER1UserKey&encrypt=true&validateCertificate=false");
"jdbc:sap://dummy_host:0/?KEY=USER1UserKey&encrypt=true&validateCertificate=false&sessionVariable:APPLICATION=JavaQuery.java");

//Option2, specify the connection parameters
//"jdbc:sap://10.11.123.134:39015/?encrypt=true&validateCertificate=false", "User1", "Password1");
Expand Down Expand Up @@ -211,6 +211,9 @@ See [JDBC Command-Line Connection Options](https://help.sap.com/docs/SAP_HANA_CL
}
```

> [!NOTE]
> The `sessionVariable:APPLICATION` parameter sets a custom application name for the connection. This value can be viewed in the `CLIENT_APPLICATION` column of the `M_CONNECTIONS` system view and may also appear in SAP HANA telemetry data.

3. Compile the `.java` file into a `.class` file using the following command.

[OPTION BEGIN [Windows]]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 25 additions & 5 deletions tutorials/hana-clients-node/hana-clients-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ npm list @sap/hana-client

var connOptions = {
//Option 1, retrieve the connection parameters from the hdbuserstore
serverNode: '@USER1UserKey', //host, port, uid, and pwd retrieved from hdbuserstore
serverNode: '@USER1UserKey', //host, port, uid, and pwd retrieved from hdbuserstore
sslValidateCertificate: 'false', //Must be set to false when connecting to an SAP HANA on-premise instance that uses a self-signed certificate.
'sessionVariable:APPLICATION': 'nodeQuery.js', //Optional custom application name

//Option 2, specify the connection parameters
//serverNode: 'host:port',
Expand All @@ -247,8 +249,6 @@ npm list @sap/hana-client

//As of SAP HANA client 2.6, connections on port 443 enable encryption by default (HANA Cloud).
//encrypt: 'true', //Must be set to true when connecting to HANA as a Service
sslValidateCertificate: 'false', //Must be set to false when connecting to an SAP HANA on-premise instance that uses a self-signed certificate.

//For encrypted connections, the default crypto provider is mscrypto on Windows or openSSL on Linux or macos
//To use the SAP crypto provider, uncomment the below line.
//sslCryptoProvider: 'commoncrypto',
Expand Down Expand Up @@ -286,6 +286,9 @@ npm list @sap/hana-client
connection.disconnect();
```

> [!NOTE]
> The `sessionVariable:APPLICATION` parameter sets a custom application name for the connection. This value can be viewed in the `CLIENT_APPLICATION` column of the `M_CONNECTIONS` system view and may also appear in SAP HANA telemetry data.

3. Run the app.

```Shell
Expand All @@ -298,7 +301,24 @@ npm list @sap/hana-client

Notice in the documentation that the above methods support being called in a synchronous or asynchronous manner. Two examples showing the drivers methods being used asynchronously are shown in the next two steps.

4. To enable debug logging of the SAP HANA Node.js client, enter the following command and then rerun the app.
4. After running the application, you can verify that the custom application name (nodeQuery.js) was successfully set by querying the `M_CONNECTIONS` system view from any SQL client (i.e. SAP HANA Cloud Central) connected to the same SAP HANA Cloud Instance.

Execute the following SQL.
```SQL
SELECT
CLIENT_APPLICATION,
CLIENT_TYPE,
USER_NAME
FROM M_CONNECTIONS
WHERE USER_NAME = CURRENT_USER
ORDER BY START_TIME DESC;
```

A row similar to the one highlighted below should appear, with `CLIENT_APPLICATION` being nodeQuery.js.

![Checking Node application name](custom-application-name-query.png)

5. To enable debug logging of the SAP HANA Node.js client, enter the following command and then rerun the app.

[OPTION BEGIN [Windows]]

Expand Down Expand Up @@ -386,7 +406,7 @@ Connection pooling can improve performance when making multiple, brief connectio

var connOptions = {
//Option 1, retrieve the connection parameters from the hdbuserstore
serverNode: '@USER1UserKey' //host, port, uid, and pwd retrieved from hdbuserstore
serverNode: '@USER1UserKey', //host, port, uid, and pwd retrieved from hdbuserstore

//Option 2, specify the connection parameters
//serverNode: 'host:port',
Expand Down
Binary file added tutorials/hana-clients-odbc/advanced-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading