Skip to content

Commit fd02980

Browse files
authored
Merge pull request #24115 from danielva/master
Data lake client update
2 parents 0247d42 + 51ecbf6 commit fd02980

28 files changed

Lines changed: 223 additions & 318 deletions
3.68 KB
Loading

tutorials/hana-cloud-dl-clients-dot-net/hana-cloud-dl-clients-dot-net.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@ primary_tag: software-product-function>sap-hana-cloud--data-lake
77
---
88

99
# Connect to Data Lake Relational Engine Using the .NET Driver
10+
1011
<!-- description --> Create and debug a .NET application that connects to a data lake Relational Engine.
1112

1213
## Prerequisites
13-
- You have completed the first tutorial in this group.
14+
15+
- You have completed the first tutorial in this group.
1416

1517
## You will learn
16-
- How to install the .NET SDK
17-
- How to create and debug a .NET application that queries a data lake Relational Engine
18+
19+
- How to install the .NET SDK
20+
- How to create and debug a .NET application that queries a data lake Relational Engine
1821

1922
## Intro
23+
2024
[.NET](https://en.wikipedia.org/wiki/.NET_Core) is a free and open-source software framework for Microsoft Windows, Linux and Mac operating systems and is the successor to the .NET Framework. .NET was previously known as .NET Core.
2125

2226
---
2327

2428
### Install the .NET SDK
29+
2530
The first step is to check if you have the .NET SDK installed and what version it is. Enter the following command:
2631

2732
```Shell
2833
dotnet --version
2934
```
35+
3036
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 9.0.101.
3137

3238
If the .NET SDK is not installed, download it from [Download .NET](https://dotnet.microsoft.com/download) and run the installer on Microsoft Windows.
@@ -38,9 +44,9 @@ On Linux, follow the instructions for the appropriate Linux version such as [Ins
3844

3945
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.
4046

41-
4247
### Create a .NET application that queries a data lake Relational Engine
43-
1. Create a new console app with the below commands:
48+
49+
1. Create a new console app with the below commands:
4450

4551
```Shell (Microsoft Windows)
4652
cd %HOMEPATH%/DataLakeClientsTutorial
@@ -52,7 +58,7 @@ In order for the shell to recognize that the .NET SDK is installed and for any `
5258
dotnet new console -o dotNET
5359
```
5460

55-
2. Open the `dotNET.csproj` file:
61+
2. Open the `dotNET.csproj` file:
5662

5763
```Shell (Microsoft Windows)
5864
cd dotNET
@@ -69,50 +75,44 @@ In order for the shell to recognize that the .NET SDK is installed and for any `
6975
```Shell (Microsoft Windows)
7076
<ItemGroup>
7177
<Reference Include="Sap.Data.SQLAnywhere.Core.v2.1">
72-
<HintPath>C:\SAP\DLClient\IQ-17_1\Assembly\Core2.1\Sap.Data.SQLAnywhere.Core.v2.1.dll</HintPath>
78+
<HintPath>C:\SAP\hdlclient\sdk\dotnet\Sap.Data.SQLAnywhere.Core.v2.1.dll</HintPath>
7379
</Reference>
7480
</ItemGroup>
7581
```
7682

7783
```Shell (Linux)
7884
<ItemGroup>
7985
<Reference Include="Sap.Data.SQLAnywhere.Core.v2.1">
80-
<HintPath>/home/dan/sap/dlclient/IQ-17_1/assembly/core2.1/Sap.Data.SQLAnywhere.Core.v2.1.dll</HintPath>
86+
<HintPath>/home/dan/sap/hdlclient/sdk/dotnet/Sap.Data.SQLAnywhere.Core.v2.1.dll</HintPath>
8187
</Reference>
8288
</ItemGroup>
8389
```
8490

85-
Note that if the developer licensed version of the data lake Client was installed the path might be similar to
86-
87-
```
88-
C:\SAP\hdlclient\sdk\dotnet\Sap.Data.SQLAnywhere.Core.v2.1.dll
89-
or
90-
/home/dan/sap/hdlclient/sdk/dotnet/Sap.Data.SQLAnywhere.Core.v2.1.dll
91-
```
92-
93-
![dotNET.csproj code](dotNET-csproj-code.png)
91+
![dotNET.csproj updates](dotNET-csproj-code.png)
9492

9593
Once the `dotNet.csproj` file has been updated, save and close the file.
9694

97-
3. Run the app to validate that data lake driver can be loaded:
95+
3. Run the app to validate that data lake driver can be loaded:
9896

9997
```Shell
10098
dotnet run
10199
```
102-
>If an error occurs, double check that the hintpath is correct and that the IQ.sh variables have been set.
100+
101+
>If an error occurs, double check that the hintpath is correct and on Linux that the script hdlclienv.sh to set the variables has been run.
103102

104103
![Result of running the app](result0.png)
105104

106-
4. Open an editor to edit the file `Program.cs`.
105+
4. Open an editor to edit the file `Program.cs`.
106+
107107
```Shell (Windows)
108108
notepad Program.cs
109109
```
110110

111111
```Shell (Linux)
112112
pico Program.cs
113113
```
114-
115-
5. Replace the entire contents of `Program.cs` with the code below. Update the host value in the connection string.
114+
115+
5. Replace the entire contents of `Program.cs` with the code below. Update the host value in the connection string.
116116

117117
```C#
118118
using System;
12 KB
Loading
-8.95 KB
Loading

tutorials/hana-cloud-dl-clients-golang/hana-cloud-dl-clients-golang.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ primary_tag: software-product-function>sap-hana-cloud--data-lake
77
---
88

99
# Connect to Data Lake Relational Engine Using the Go Driver
10+
1011
<!-- description --> Create and debug a Go application that connects to data lake Relational Engine.
1112

1213
## Prerequisites
13-
- You have completed the first tutorial in this group.
14+
15+
- You have completed the first tutorial in this group.
1416

1517
## You will learn
16-
- How to install Go
17-
- How to create and debug a Go application that queries a data lake Relational Engine
18+
19+
- How to install Go
20+
- How to create and debug a Go application that queries a data lake Relational Engine
1821

1922
## Intro
23+
2024
Go is an open-source programming language developed by Google to increase productivity among programmers. For more information, see the [Go Documentation](https://golang.org/doc/).
2125

2226
---
2327

2428
### Install Go
29+
2530
The first step is to check if Go is installed, and if so, which version. To do so, enter the following command:
2631

2732
```Shell
@@ -30,7 +35,7 @@ go version
3035

3136
![go version linux](version2.png)
3237

33-
If Go is installed, then it will return the currently installed version, such as 1.23.4
38+
If Go is installed, then it will return the currently installed version, such as 1.26.1
3439

3540
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.
3641

@@ -39,6 +44,7 @@ On Linux, follow the instructions for the appropriate Linux version: [Installing
3944
>Note: A new shell window must be opened for the system to recognize the Go installation and for executing any future Go commands.
4045
4146
### Configure the environment
47+
4248
The data lake Relational Engine Client interface for Go, like the other data lake Relational Engine client interfaces (except JDBC), makes use of a C library named SQLDBC.
4349

4450
The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https://golang.org/cmd/cgo/). For further information on the following steps, consult [Go (golang) Driver](https://help.sap.com/docs/hana-cloud-data-lake/client-interfaces/go-golang-driver) in the SAP HANA Cloud, Data Lake Client Interfaces Reference Guide. In order to use the Go Driver, a 64-bit `gcc` compiler is required.
@@ -68,8 +74,9 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
6874
```Shell
6975
gcc --version
7076
```
77+
7178
On Linux (if needed), 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.
72-
79+
7380
![gcc 64-bit](gccLinux.png)
7481
7582
2. Examine the Go environment by running the below command:
@@ -84,15 +91,14 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
8491
8592
3. Set the `CGO_LDFLAGS` environment variable to point to the location of the HDLRE client library as shown below.
8693
87-
On Windows, search **Edit the System Environment Variables** and click on **Environment Variables**. Add a **NEW** user variable. Set the variable name to **CGO_LDFLAGS** and the value as the location of `dbcapi` library: `C:\SAP\hdlclient\IQ-17_1\bin64\dbcapi.dll`
94+
On Windows, search **Edit the System Environment Variables** and click on **Environment Variables**. Add a **NEW** user variable. Set the variable name to **CGO_LDFLAGS** and the value as the location of `dbcapi` library: `C:\SAP\hdlclient\bin64\dbcapi.dll`
8895
8996
![Set Environment Variables](setEnvVar.png)
9097
9198
>It is also possible on Microsoft Windows to set this using the SETX command from a shell.
9299
93-
94100
On Linux, check if the following variable are defined.
95-
101+
96102
```Shell (Linux)
97103
echo $CGO_LDFLAGS
98104
echo $LD_LIBRARY_PATH
@@ -102,35 +108,34 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
102108
103109
```Shell (Linux)
104110
pico .bashrc
105-
export CGO_LDFLAGS=$HOME/sap/dlclient/IQ-17_1/lib64/libdbcapi_r.so
106-
export CGO_LDFLAGS=$HOME/sap/hdlclient/lib64/libdbcapi_r.so
107-
export LD_LIBRARY_PATH=$HOME/sap/dlclient/IQ-17_1/lib64
108-
export LD_LIBRARY_PATH=$HOME/sap/hdlclient/lib64
111+
export CGO_LDFLAGS=$HDL_CLIENT_HOME/lib64/libdbcapi_r.so
112+
export LD_LIBRARY_PATH=$HDL_CLIENT_HOME/lib64
109113
```
110-
114+
111115
![.bash_profile contents](bashProfileAfterCGO.png)
112116
113117
4. Navigate to the driver folder and create a Go module. Note that the path may be different depending on the data lake client install used.
114118
115119
```Shell (Windows)
116-
cd %IQDIR17%\sdk\golang\SAP\go-hdlre\driver
120+
cd %HDL_CLIENT_HOME%\sdk\golang\SAP\go-hdlre\driver
117121
go mod init "SAP/go-hdlre/driver"
118122
go mod tidy
119123
```
120-
124+
121125
```Shell (Linux)
122-
cd $IQDIR17/sdk/golang-hdlre/src/SAP/go-hdlre/driver
123-
cd $IQDIR17/sdk/golang/SAP/go-hdlre/driver/
126+
cd $HDL_CLIENT_HOME/sdk/golang/SAP/go-hdlre/driver/
124127
go mod init "SAP/go-hdlre/driver"
125128
go mod tidy
126129
```
130+
127131
![createModule](createModule.png)
128132
129133
The contents of the data lake Client folder is not writeable so you may need to change the permissions on the driver folder or copy files to a new location.
130134
131135
### Create a Go application that queries an SAP data lake Relational Engine
136+
132137
1. In a shell, create a folder named `go`, enter the newly created directory, and open a file named `goQuery.go` in an editor.
133-
138+
134139
```Shell (Windows)
135140
mkdir %HOMEPATH%\DataLakeClientsTutorial\go
136141
cd %HOMEPATH%\DataLakeClientsTutorial\go
@@ -200,27 +205,24 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
200205
go mod init "go/goQuery"
201206
go mod tidy
202207
notepad go.mod
203-
```
204-
208+
```
205209
206210
```Shell (Linux)
207211
go mod init "go/goQuery"
208212
go mod tidy
209213
pico go.mod
210214
```
211215
212-
4. Add the code below to `go.mod` under the go 1.23.4 (version) line:
213-
216+
4. Add the code below to `go.mod` under the go 1.26.1 (version) line:
217+
214218
>Ensure you have the correct path to the driver folder. The path depends on your installation. Note that two example locations are provided. Choose the one that's closest to your installation and edit it if necessary.
215219

216220
```Code (Windows)
217-
replace SAP/go-hdlre/driver v0.1.0 => C:\SAP\dlclient\IQ-17_1\SDK\golang\SAP\go-hdlre\driver
218221
replace SAP/go-hdlre/driver v0.1.0 => C:\SAP\hdlclient\sdk\golang\SAP\go-hdlre\driver
219222
require SAP/go-hdlre/driver v0.1.0
220223
```
221-
224+
222225
```Code (Linux)
223-
replace SAP/go-hdlre/driver v0.1.0 => /home/name/sap/dlclient/IQ-17_1/sdk/golang-hdlre/src/SAP/go-hdlre/driver
224226
replace SAP/go-hdlre/driver v0.1.0 => /home/name/sap/hdlclient/sdk/golang/SAP/go-hdlre/driver
225227
require SAP/go-hdlre/driver v0.1.0
226228
```
@@ -242,8 +244,8 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
242244

243245
For more information on the API's used, consult the SAP HANA Cloud, data lake connection specific properties at [Connect from Go to Data Lake Relational Engine](https://help.sap.com/docs/SAP_HANA_DATA_LAKE/a895964984f210158925ce02750eb580/0b55e305d26941c191c71eaa07f72bb5.html), [Go Database/SQL Tutorial](http://go-database-sql.org/index.html), and [Package SQL](https://golang.org/pkg/database/sql/)
244246
245-
246247
### Debug the application
248+
247249
Visual Studio Code provides plugins for Go and can be used to debug an application.
248250
249251
1. If you have not already done so, download [Visual Studio Code](https://code.visualstudio.com/Download).
@@ -272,11 +274,8 @@ Visual Studio Code provides plugins for Go and can be used to debug an applicati
272274
273275
>Note that debugging can also be performed from the command line using [Delve](https://github.com/go-delve/delve ).
274276
275-
276-
277277
### Knowledge check
278-
Congratulations! You have now created and debugged a Go application that connects to and queries a data lake Relational Engine.
279-
280278
279+
Congratulations! You have now created and debugged a Go application that connects to and queries a data lake Relational Engine.
281280
282281
---

tutorials/hana-cloud-dl-clients-jdbc/hana-cloud-dl-clients-jdbc.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ primary_tag: software-product-function>sap-hana-cloud--data-lake
77
---
88

99
# Connect to Data Lake Relational Engine Using the JDBC Driver
10+
1011
<!-- description --> Create and debug a Java application that connects to the data lake Relational Engine.
1112

1213
## Prerequisites
13-
- You have completed the first tutorial in this group.
14+
15+
- You have completed the first tutorial in this group.
1416

1517
## You will learn
16-
- How to create and debug a Java application that connects to and queries a data lake Relational Engine database
18+
19+
- How to create and debug a Java application that connects to and queries a data lake Relational Engine database
1720

1821
## Intro
19-
[Java Database Connectivity](https://en.wikipedia.org/wiki/Java_Database_Connectivity) (JDBC) provides an [API](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) for accessing databases from Java. An application written to the JDBC standard can be ported to other databases. Database vendors provide JDBC drivers for their database products. Further details of the SAP JDBC driver can be found at [JDBC Driver](https://help.sap.com/docs/hana-cloud-data-lake/client-interfaces/jdbc-driver).
2022

23+
[Java Database Connectivity](https://en.wikipedia.org/wiki/Java_Database_Connectivity) (JDBC) provides an [API](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) for accessing databases from Java. An application written to the JDBC standard can be ported to other databases. Database vendors provide JDBC drivers for their database products. Further details of the SAP JDBC driver can be found at [JDBC Driver](https://help.sap.com/docs/hana-cloud-data-lake/client-interfaces/jdbc-driver).
2124

2225
---
2326

2427
### Install a JDK
28+
2529
Ensure that you have a Java Development Kit (JDK) installed and make sure it is accessible from your path.
2630

2731
You should already have the SAP Java Virtual Machine (JVM) installed after completing the [SAP HANA Cloud, Data Lake Client Interfaces Overview](https://developers.sap.com/tutorials/hana-cloud-dl-clients-overview.html#f86d9ece-1bd4-4add-81a4-aedc6b290e97) prerequisite tutorial.
@@ -43,17 +47,17 @@ For Linux, the following command will install Java on openSUSE Leap 15.4.
4347
sudo zypper install java-11-openjdk-devel
4448
```
4549

46-
4750
### The data lake Relational Engine JDBC driver
48-
The data lake Relational Engine JDBC driver is a type 2 driver, which means it has a native (non-Java) component. For additional details see [Type 2 driver – Native-API driver](https://en.wikipedia.org/wiki/JDBC_driver#Type_2_driver_%E2%80%93_Native-API_driver). The driver is located in `%IQDIR17%\java\sajdbc4.jar` on Microsoft Windows and `$IQDIR17/java/sajdbc4.jar` on Linux. The native component is at `%IQDIR17%\Bin64\dbjdbc17.dll` on Microsoft Windows and `$IQDIR17\lib64\libdbjdbc17.so` on Linux.
4951

50-
See [data lake Relational Engine JDBC driver](https://help.sap.com/docs/hana-cloud-data-lake/developer-guide-for-data-lake-relational-engine/jdbc-drivers) for additional details.
52+
The data lake Relational Engine JDBC driver is a type 2 driver, which means it has a native (non-Java) component. For additional details see [Type 2 driver – Native-API driver](https://en.wikipedia.org/wiki/JDBC_driver#Type_2_driver_%E2%80%93_Native-API_driver). The driver is located in `%HDL_CLIENT_HOME%\java\sajdbc4.jar` on Microsoft Windows and `$HDL_CLIENT_HOME/java/sajdbc4.jar` on Linux. The native component is at `%HDL_CLIENT_HOME%\Bin64\dbjdbc17.dll` on Microsoft Windows and `$HDL_CLIENT_HOME\lib64\libdbjdbc17.so` on Linux.
5153

54+
See [data lake Relational Engine JDBC driver](https://help.sap.com/docs/hana-cloud-data-lake/developer-guide-for-data-lake-relational-engine/jdbc-drivers) for additional details.
5255

5356
### Create a Java application that queries data lake Relational Engine
57+
5458
1. The following commands create a folder named `java`, enter the newly created directory, create a file named `JavaQuery.java`, and open the file in notepad.
5559

56-
>The HOMEPATH environment variable should resolve to your user in your users folder such as c:\users\dan. Its value can be seen on Microsoft Windows by entering echo %HOMEPATH% into a shell.
60+
>The HOMEPATH environment variable should resolve to your user in your user's folder such as c:\users\dan. Its value can be seen on Microsoft Windows by entering echo %HOMEPATH% into a shell.
5761
5862
```Shell (Microsoft Windows)
5963
mkdir %HOMEPATH%\DataLakeClientsTutorial\java
@@ -112,26 +116,27 @@ See [data lake Relational Engine JDBC driver](https://help.sap.com/docs/hana-clo
112116
Compile the `.java` file into a `.class` file using the following command:
113117
114118
```Shell (Microsoft Windows)
115-
javac -cp %IQDIR17%\Java\sajdbc4.jar;. JavaQuery.java
119+
javac -cp %HDL_CLIENT_HOME%\Java\sajdbc4.jar;. JavaQuery.java
116120
```
117121
```Shell (Linux)
118-
javac -cp $IQDIR17/java/sajdbc4.jar:. JavaQuery.java
122+
javac -cp $HDL_CLIENT_HOME/java/sajdbc4.jar:. JavaQuery.java
119123
```
120124
121125
4. Run `JavaQuery.class` and indicate where the JDBC driver is located.
122126
123127
```Shell (Microsoft Windows)
124-
java -classpath %IQDIR17%\Java\sajdbc4.jar;. JavaQuery
128+
java -classpath %HDL_CLIENT_HOME%\Java\sajdbc4.jar;. JavaQuery
125129
```
126130
```Shell (Linux)
127-
java -classpath $IQDIR17/java/sajdbc4.jar:. JavaQuery
131+
java -classpath $HDL_CLIENT_HOME/java/sajdbc4.jar:. JavaQuery
128132
```
129133
130134
![Java Query](jdbc-query.png)
131135
132136
See [JDBC Program Structure](https://help.sap.com/viewer/a894a54d84f21015b142ffe773888f8c/latest/en-US/3bd5a89b6c5f1014ad1bae9e04645f43.html) for additional details.
133137
134138
### Debug the application
139+
135140
Visual Studio Code can run and debug a Java application. It is a lightweight but powerful source code editor available on Microsoft Windows, macOS, and Linux.
136141
137142
1. If required, [Download Visual Studio Code](https://code.visualstudio.com/Download).
@@ -148,7 +153,7 @@ Visual Studio Code can run and debug a Java application. It is a lightweight but
148153
149154
![referenced libraries](ref-libraries.png)
150155
151-
The JDBC driver is located at `%IQDIR17%\Java\sajdbc4.jar` on Microsoft Windows and `$IQDIR17/java/sajdbc4.jar` on Linux.
156+
The JDBC driver is located at `%HDL_CLIENT_HOME%\Java\sajdbc4.jar` on Microsoft Windows and `$HDL_CLIENT_HOME/java/sajdbc4.jar` on Linux.
152157
153158
5. Place a breakpoint and then select **Run | Start Debugging**.
154159
@@ -159,6 +164,7 @@ Visual Studio Code can run and debug a Java application. It is a lightweight but
159164
![VS Code Debugging](debugging.png)
160165
161166
### Knowledge check
167+
162168
Congratulations! You have now created and debugged a Java application that connects to and queries a data lake Relational Engine database.
163169
164170
---

0 commit comments

Comments
 (0)