You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Connect to Data Lake Relational Engine Using the .NET Driver
10
+
10
11
<!-- description --> Create and debug a .NET application that connects to a data lake Relational Engine.
11
12
12
13
## Prerequisites
13
-
- You have completed the first tutorial in this group.
14
+
15
+
- You have completed the first tutorial in this group.
14
16
15
17
## 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
18
21
19
22
## Intro
23
+
20
24
[.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.
21
25
22
26
---
23
27
24
28
### Install the .NET SDK
29
+
25
30
The first step is to check if you have the .NET SDK installed and what version it is. Enter the following command:
26
31
27
32
```Shell
28
33
dotnet --version
29
34
```
35
+
30
36
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.
31
37
32
38
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
38
44
39
45
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.
40
46
41
-
42
47
### 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:
44
50
45
51
```Shell (Microsoft Windows)
46
52
cd %HOMEPATH%/DataLakeClientsTutorial
@@ -52,7 +58,7 @@ In order for the shell to recognize that the .NET SDK is installed and for any `
52
58
dotnet new console -o dotNET
53
59
```
54
60
55
-
2. Open the `dotNET.csproj` file:
61
+
2. Open the `dotNET.csproj` file:
56
62
57
63
```Shell (Microsoft Windows)
58
64
cd dotNET
@@ -69,50 +75,44 @@ In order for the shell to recognize that the .NET SDK is installed and for any `
# Connect to Data Lake Relational Engine Using the Go Driver
10
+
10
11
<!-- description --> Create and debug a Go application that connects to data lake Relational Engine.
11
12
12
13
## Prerequisites
13
-
- You have completed the first tutorial in this group.
14
+
15
+
- You have completed the first tutorial in this group.
14
16
15
17
## 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
18
21
19
22
## Intro
23
+
20
24
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/).
21
25
22
26
---
23
27
24
28
### Install Go
29
+
25
30
The first step is to check if Go is installed, and if so, which version. To do so, enter the following command:
26
31
27
32
```Shell
@@ -30,7 +35,7 @@ go version
30
35
31
36

32
37
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
34
39
35
40
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.
36
41
@@ -39,6 +44,7 @@ On Linux, follow the instructions for the appropriate Linux version: [Installing
39
44
>Note: A new shell window must be opened for the system to recognize the Go installation and for executing any future Go commands.
40
45
41
46
### Configure the environment
47
+
42
48
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.
43
49
44
50
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:/
68
74
```Shell
69
75
gcc --version
70
76
```
77
+
71
78
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
+
73
80

74
81
75
82
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:/
84
91
85
92
3. Set the `CGO_LDFLAGS` environment variable to point to the location of the HDLRE client library as shown below.
86
93
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`
88
95
89
96

90
97
91
98
>It is also possible on Microsoft Windows to set this using the SETX command from a shell.
92
99
93
-
94
100
On Linux, check if the following variable are defined.
95
-
101
+
96
102
```Shell (Linux)
97
103
echo $CGO_LDFLAGS
98
104
echo $LD_LIBRARY_PATH
@@ -102,35 +108,34 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
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.
114
118
115
119
```Shell (Windows)
116
-
cd %IQDIR17%\sdk\golang\SAP\go-hdlre\driver
120
+
cd %HDL_CLIENT_HOME%\sdk\golang\SAP\go-hdlre\driver
117
121
go mod init "SAP/go-hdlre/driver"
118
122
go mod tidy
119
123
```
120
-
124
+
121
125
```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/
124
127
go mod init "SAP/go-hdlre/driver"
125
128
go mod tidy
126
129
```
130
+
127
131

128
132
129
133
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.
130
134
131
135
### Create a Go application that queries an SAP data lake Relational Engine
136
+
132
137
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
+
134
139
```Shell (Windows)
135
140
mkdir %HOMEPATH%\DataLakeClientsTutorial\go
136
141
cd %HOMEPATH%\DataLakeClientsTutorial\go
@@ -200,27 +205,24 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
200
205
go mod init "go/goQuery"
201
206
go mod tidy
202
207
notepad go.mod
203
-
```
204
-
208
+
```
205
209
206
210
```Shell (Linux)
207
211
go mod init "go/goQuery"
208
212
go mod tidy
209
213
pico go.mod
210
214
```
211
215
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
+
214
218
>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.
@@ -242,8 +244,8 @@ The Go driver loads the SQLDBC library named `libdbcapiHDB` using [cgo](https:/
242
244
243
245
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/)
244
246
245
-
246
247
### Debug the application
248
+
247
249
Visual Studio Code provides plugins for Go and can be used to debug an application.
248
250
249
251
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
272
274
273
275
>Note that debugging can also be performed from the command line using [Delve](https://github.com/go-delve/delve ).
274
276
275
-
276
-
277
277
### Knowledge check
278
-
Congratulations! You have now created and debugged a Go application that connects to and queries a data lake Relational Engine.
279
-
280
278
279
+
Congratulations! You have now created and debugged a Go application that connects to and queries a data lake Relational Engine.
# Connect to Data Lake Relational Engine Using the JDBC Driver
10
+
10
11
<!-- description --> Create and debug a Java application that connects to the data lake Relational Engine.
11
12
12
13
## Prerequisites
13
-
- You have completed the first tutorial in this group.
14
+
15
+
- You have completed the first tutorial in this group.
14
16
15
17
## 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
17
20
18
21
## 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).
20
22
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).
21
24
22
25
---
23
26
24
27
### Install a JDK
28
+
25
29
Ensure that you have a Java Development Kit (JDK) installed and make sure it is accessible from your path.
26
30
27
31
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.
43
47
sudo zypper install java-11-openjdk-devel
44
48
```
45
49
46
-
47
50
### 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.
49
51
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.
51
53
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.
52
55
53
56
### Create a Java application that queries data lake Relational Engine
57
+
54
58
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.
55
59
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.
57
61
58
62
```Shell (Microsoft Windows)
59
63
mkdir %HOMEPATH%\DataLakeClientsTutorial\java
@@ -112,26 +116,27 @@ See [data lake Relational Engine JDBC driver](https://help.sap.com/docs/hana-clo
112
116
Compile the `.java` file into a `.class` file using the following command:
See [JDBC Program Structure](https://help.sap.com/viewer/a894a54d84f21015b142ffe773888f8c/latest/en-US/3bd5a89b6c5f1014ad1bae9e04645f43.html) for additional details.
133
137
134
138
### Debug the application
139
+
135
140
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.
136
141
137
142
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
148
153
149
154

150
155
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.
152
157
153
158
5. Place a breakpoint and thenselect**Run| Start Debugging**.
154
159
@@ -159,6 +164,7 @@ Visual Studio Code can run and debug a Java application. It is a lightweight but
159
164

160
165
161
166
### Knowledge check
167
+
162
168
Congratulations! You have now created and debugged a Java application that connects to and queries a data lake Relational Engine database.
0 commit comments