diff --git a/tutorials/hana-clients-cf/add-cf-runtime-entitlement.png b/tutorials/hana-clients-cf/add-cf-runtime-entitlement.png index 23bea4ccf9..7ebbd23037 100644 Binary files a/tutorials/hana-clients-cf/add-cf-runtime-entitlement.png and b/tutorials/hana-clients-cf/add-cf-runtime-entitlement.png differ diff --git a/tutorials/hana-clients-cf/cf-runtime-entitlement.png b/tutorials/hana-clients-cf/cf-runtime-entitlement.png index 1c0ad1e446..0a343fc40b 100644 Binary files a/tutorials/hana-clients-cf/cf-runtime-entitlement.png and b/tutorials/hana-clients-cf/cf-runtime-entitlement.png differ diff --git a/tutorials/hana-clients-cf/hana-clients-cf.md b/tutorials/hana-clients-cf/hana-clients-cf.md index 04e8a01c46..227febc790 100644 --- a/tutorials/hana-clients-cf/hana-clients-cf.md +++ b/tutorials/hana-clients-cf/hana-clients-cf.md @@ -7,17 +7,21 @@ primary_tag: software-product>sap-hana-cloud --- # Create a Cloud Foundry or XS Advanced App that Queries SAP HANA + Create a Node.js app that queries SAP HANA and can be run in Cloud Foundry or XS Advanced. ## Prerequisites - - You have completed the first 4 tutorials in this mission + +- You have completed the first 4 tutorials in this mission ## You will learn - - How to use the command line interface (CLI) to deploy a Node.js app to Cloud Foundry or XS advanced - - How to view the logs and enable tracing in the deployed app - - How to connect from a Node.js app running in Cloud Foundry to an on-premise SAP HANA instance through the Cloud Connector + +- How to use the command line interface (CLI) to deploy a Node.js app to Cloud Foundry or XS advanced +- How to view the logs and enable tracing in the deployed app +- How to connect from a Node.js app running in Cloud Foundry to an on-premise SAP HANA instance through the Cloud Connector ## Intro + In the previous tutorials, applications that queried SAP HANA were run on a local machine. In this tutorial, a simple application will be run within the SAP BTP which uses Cloud Foundry or within the SAP HANA, express edition which uses XS advanced (and is also based on Cloud Foundry). For additional details, consult [Developing Applications on SAP BTP, Cloud Foundry runtime](https://learning.sap.com/learning-journeys/developing-applications-on-sap-btp-cloud-foundry-runtime) or [The XS Advanced Programming Model](https://help.sap.com/docs/SAP_HANA_PLATFORM/4505d0bdaf4948449b7f7379d24d0f0d/df19a03dc07e4ba19db4e0006c1da429.html). @@ -25,7 +29,8 @@ For additional details, consult [Developing Applications on SAP BTP, Cloud Found --- ### Get started with the Command Line Interface (CLI) -The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI used for apps running in SAP HANA, express edition is named `xs`. + +The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI used for apps running in SAP HANA, express edition is named `xs`. 1. Check to see if you have the CF CLI installed and verify the version. @@ -78,7 +83,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u ```Shell cf api ``` - + **XS advanced** ```Shell @@ -111,11 +116,11 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u ![services](cliExample.png) - Additional details can be found at [Getting Started with the cf CLI](https://docs.cloudfoundry.org/cf-cli/getting-started.html) and [Get Started with the XS CLI Client](https://help.sap.com/docs/SAP_HANA_PLATFORM/4505d0bdaf4948449b7f7379d24d0f0d/c00ed3f74c12479e9f3a8cdeb6e1519a.html). - + Additional details can be found at [Getting Started with the cf CLI](https://docs.cloudfoundry.org/cf-cli/getting-started.html) and [Get Started with the XS CLI Client](https://help.sap.com/docs/SAP_HANA_PLATFORM/4505d0bdaf4948449b7f7379d24d0f0d/c00ed3f74c12479e9f3a8cdeb6e1519a.html). ### Create Node.js app that queries SAP HANA -1. Create a folder named `nodeCF\nodeQueryCF` and enter the newly created directory. + +1. Create a folder named `nodeCF\nodeQueryCF` and enter the newly created directory. ```Shell (Microsoft Windows) mkdir %HOMEPATH%\HANAClientsTutorial\nodeCF\nodeQueryCF @@ -127,7 +132,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u cd $HOME/HANAClientsTutorial/nodeCF/nodeQueryCF ``` -2. Initialize the project, install [express](https://www.npmjs.com/package/express), and `@sap/hana-client` from NPM. +2. Initialize the project, install [express](https://www.npmjs.com/package/express), and `@sap/hana-client` from NPM. ```Shell npm init -y @@ -135,7 +140,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u npm install @sap/hana-client ``` -3. Open a file named `server.js` in an editor. +3. Open a file named `server.js` in an editor. ```Shell (Microsoft Windows) notepad server.js @@ -197,7 +202,6 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u Update the values for host and port. - 5. Run and test the app locally. ```Shell @@ -208,8 +212,8 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u ![running locally](local.png) - ### Deploy and test in SAP BTP or XS Advanced + 1. Create a deployment descriptor. ```Shell (Microsoft Windows) @@ -238,13 +242,13 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u For additional details, consult [App Manifest Attribute Reference](https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html). 2. Deploy the app to Cloud Foundry or XS advanced. - + Before deploying the app to Cloud Foundry, ensure that you have the **Cloud Foundry Runtime Environment** entitlement enabled for your subaccount. You can find the Entitlements page in the left-hand side menu of SAP BTP Cockpit. - + ![Entitlement for CF runtime](cf-runtime-entitlement.png) - - If necessary, you can add the entitlement by clicking **Configure Entitlements** > **Add Service Plans** > **Cloud Foundry Runtime**. Then select the `MEMORY` plan. Don't forget to save your changes when finished. - + + If necessary, you can add the entitlement by clicking Edit. Don't forget to save your changes when finished. + ![Add CF Memory service plan](add-cf-runtime-entitlement.png) After verifying that you have the necessary entitlements, run the following: @@ -260,7 +264,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u ```Shell xs push ``` - + ![push result](xsPush.png) Alternatively, the URL of the app can be found by running the following command: @@ -273,10 +277,10 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u xs app nodeQueryCF ``` -3. Test the app. +3. Test the app. ![cf app](cfApp.png) - + **XS advanced** ![xs app](xsApp.png) @@ -287,9 +291,9 @@ For additional details see: [Tutorial: Setting up your JavaScript Application in XS Advanced](https://help.sap.com/docs/SAP_HANA_PLATFORM/4505d0bdaf4948449b7f7379d24d0f0d/30d629eab05d41b9b853d417bdb2fc08.html) - ### Additional commands -1. The available buildpacks can be found using the command below. + +1. The available buildpacks can be found using the command below. ```Shell cf buildpacks @@ -305,14 +309,14 @@ For additional details see: ``` -2. The app can be stopped and started with the below commands: +2. The app can be stopped and started with the below commands: ```Shell cf stop nodeQueryCF cf start nodeQueryCF ``` -3. The applications lifecycle events can be seen with the below command: +3. The applications lifecycle events can be seen with the below command: ```Shell cf events nodeQueryCF @@ -320,7 +324,7 @@ For additional details see: ![events](events.png) -4. The logs of the application can be seen with the below command: +4. The logs of the application can be seen with the below command: ```Shell cf logs nodeQueryCF --recent @@ -332,7 +336,7 @@ For additional details see: cf logs nodeQueryCF ``` -5. As of version 2.7, the SAP HANA client interfaces can output trace information to `stdout` or `stderr`. +5. As of version 2.7, the SAP HANA client interfaces can output trace information to `stdout` or `stderr`. ```Shell cf set-env nodeQueryCF HDB_SQLDBC_TRACEFILE stdout @@ -348,8 +352,7 @@ For additional details see: ![trace](trace.png) - -6. The deployed app can also be managed in the associated cockpit. +6. The deployed app can also be managed in the associated cockpit. **SAP BTP Cockpit** @@ -365,28 +368,27 @@ For additional details see: Note that the number of running instances can be [scaled](https://docs.cloudfoundry.org/devguide/deploy-apps/cf-scale.html) if needed. - - ### Connect from the Node.js app running in the cloud to an on-premise database (optional) + The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/cloud-connector#loioe6c7616abb5710148cfcf3e75d96d596__context) enables communication from the SAP BTP running in the public internet to securely connect to a configured on-premise system such as SAP HANA, express edition. The following steps demonstrate how to do this with the previously deployed app `nodeQueryCF`. 1. Follow step 3 in [Access Remote Sources with SAP HANA Database Explorer](hana-dbx-remote-sources) to install and configure the Cloud Connector. 2. In the project created in step 2, perform the following steps to bind a connectivity service instance to the application. - * Navigate to **Service Bindings** and choose **Bind Service**. + - Navigate to **Service Bindings** and choose **Bind Service**. ![bind service](bind-service1.png) - * Add the **Connectivity** service. + - Add the **Connectivity** service. ![connectivity service](connectivity-service.png) - * Provide an instance name such as `MyConnectivityService`. + - Provide an instance name such as `MyConnectivityService`. ![connectivity service](connectivity-service2.png) - * Examine the values of the connectivity service. The indicated values below are used for the `proxyPort` and `proxyHostname` values in the `server.js` file. It will be to access the proxy service which enables communication with the cloud connector. + - Examine the values of the connectivity service. The indicated values below are used for the `proxyPort` and `proxyHostname` values in the `server.js` file. It will be to access the proxy service which enables communication with the cloud connector. ![connectivity service](connectivity-service3.png) @@ -489,21 +491,21 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit }) const _fetchJwtToken = async function(oauthUrl, oauthClient, oauthSecret) { - return new Promise ((resolve, reject) => { - const tokenUrl = oauthUrl + '/oauth/token?grant_type=client_credentials&response_type=token' + return new Promise ((resolve, reject) => { + const tokenUrl = oauthUrl + '/oauth/token?grant_type=client_credentials&response_type=token' const config = { - headers: { - Authorization: "Basic " + Buffer.from(oauthClient + ':' + oauthSecret).toString("base64") - } + headers: { + Authorization: "Basic " + Buffer.from(oauthClient + ':' + oauthSecret).toString("base64") + } } - axios.get(tokenUrl, config) + axios.get(tokenUrl, config) .then(response => { - resolve(response.data.access_token) + resolve(response.data.access_token) }) .catch(error => { - reject(error) + reject(error) }) - }) + }) } ``` @@ -515,14 +517,12 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit cf push ``` -7. The application running in the cloud, is now accessing data from an on-premise SAP HANA, express instance. +7. The application running in the cloud, is now accessing data from an on-premise SAP HANA, express instance. ![Result](proxy-result.png) ### Knowledge check -Congratulations, you have built, deployed, and run an app that queries SAP HANA in Cloud Foundry and XS advanced as well as become familiar with the command line interface. - - +Congratulations, you have built, deployed, and run an app that queries SAP HANA in Cloud Foundry and XS advanced as well as become familiar with the command line interface. ---- +--- \ No newline at end of file diff --git a/tutorials/hana-clients-choose-hana-instance/hana-clients-choose-hana-instance.md b/tutorials/hana-clients-choose-hana-instance/hana-clients-choose-hana-instance.md index 988959d0aa..349895181c 100644 --- a/tutorials/hana-clients-choose-hana-instance/hana-clients-choose-hana-instance.md +++ b/tutorials/hana-clients-choose-hana-instance/hana-clients-choose-hana-instance.md @@ -22,7 +22,7 @@ primary_tag: software-product>sap-hana-cloud ## Intro -This tutorial will provide tips and pointers on setting up an instance of [SAP HANA](https://www.sap.com/products/hana.html) running in the cloud or on-premise so that it can then be connected to using a few of the [SAP HANA Client](https://help.sap.com/docs/SAP_HANA_CLIENT) interfaces. +This tutorial covers how to configure an [SAP HANA](https://www.sap.com/products/hana.html) instance in the cloud or on-premise, to enable connections through various [SAP HANA Client](https://help.sap.com/docs/SAP_HANA_CLIENT) interfaces, along with tips to streamline the process and avoid common pitfalls. For more information on SAP HANA Cloud, consult [Introduction to SAP HANA Cloud](https://help.sap.com/docs/hana-cloud/feature-scope-description-for-sap-hana-cloud-3dd959f1b8574cb0ba19ab05cfc0d3ae/introduction-to-sap-hana-cloud). @@ -40,7 +40,6 @@ For more information on SAP HANA Cloud, consult [Introduction to SAP HANA Cloud] >**IMPORTANT**: Complete the first 3 tutorials, and then you can select any of the following tutorials about connecting with different client interfaces. - --- ### Overview of SAP HANA Cloud and SAP HANA On-premise @@ -53,7 +52,6 @@ There are multiple versions of SAP HANA. The information below is a list of lin | **[SAP HANA, express edition](https://help.sap.com/docs/SAP_HANA_EXPRESS_EDITION)** | Released in September 2016. Current version is 2.0 SPS 08. | **[SAP HANA Cloud](https://help.sap.com/docs/hana-cloud)** | Released in March 2020. New features are released quarterly. - ### SAP HANA Cloud Here are a few benefits of using SAP HANA Cloud: @@ -86,36 +84,33 @@ Information on the instance size steps for SAP HANA Cloud, SAP HANA databases ca The instructions on how to setup a free SAP HANA Cloud instance within the SAP Business Technology Platform (SAP BTP) are well covered in a number of other sources listed below. The SAP BTP Trial is available on the US10 and AP21 landscapes. When using the free SAP HANA Cloud service in productive landscapes, there is an option to transition the service from free tier to a paid service. -* [Set Up Your SAP HANA Cloud, SAP HANA Database and Understand the Basics](group.hana-cloud-get-started-1-trial) +- [Set Up Your SAP HANA Cloud, SAP HANA Database and Understand the Basics](group.hana-cloud-get-started-1-trial) -* [SAP Learning Journey - Provisioning and Administering Databases in SAP HANA Cloud](https://learning.sap.com/learning-journey/provision-and-administer-databases-in-sap-hana-cloud) +- [SAP Learning Journey - Provisioning and Administering Databases in SAP HANA Cloud](https://learning.sap.com/learning-journey/provision-and-administer-databases-in-sap-hana-cloud) -* [SAP Discovery Center - SAP HANA Cloud, SAP HANA Database Fundamentals](https://discovery-center.cloud.sap/protected/index.html#/missiondetail/3643/) - -* [Help Thomas Get Started with SAP HANA](hana-trial-advanced-analytics) +- [SAP Discovery Center - SAP HANA Cloud, SAP HANA Database Fundamentals](https://discovery-center.cloud.sap/protected/index.html#/missiondetail/3643/) +- [Help Thomas Get Started with SAP HANA](hana-trial-advanced-analytics) For more information on SAP BTP see the following product pages and help documentation: -* [https://www.sap.com/products/business-technology-platform.html](https://www.sap.com/products/business-technology-platform.html) - -* [https://developers.sap.com/topics/business-technology-platform.html](https://developers.sap.com/topics/business-technology-platform.html) +- [https://www.sap.com/products/business-technology-platform.html](https://www.sap.com/products/business-technology-platform.html) -* [https://help.sap.com/docs/btp](https://help.sap.com/docs/btp) +- [https://developers.sap.com/topics/business-technology-platform.html](https://developers.sap.com/topics/business-technology-platform.html) +- [https://help.sap.com/docs/btp](https://help.sap.com/docs/btp) Continue with this tutorial once you have created an SAP HANA Cloud instance as shown below. ![SAP HANA Cloud Trial instance](hana-cloud-instance.png) - -1. Once the SAP HANA Cloud instance is created, take note of the SQL endpoint (host:port) needed to connect to the database. The endpoint can be obtained via the copy menu item. This will be needed in subsequent tutorials in the mission. +1. Once the SAP HANA Cloud instance is created, take note of the SQL endpoint (host:port) needed to connect to the database. The endpoint can be obtained within the Actions menu on the Instances page. This will be needed in subsequent tutorials in the mission. ![SQL Endpoint](SQLEndpoint.png) >The SAP HANA Cloud, HANA database free tier instances are shut down on a nightly basis and will need to be restarted before working with them the next day. -2. Open a SQL console for your database instance from SAP HANA Cloud Central. +2. From the Actions menu, Open a SQL console for your database instance. ![Open SQL console](sql-cons.png) @@ -123,7 +118,6 @@ Continue with this tutorial once you have created an SAP HANA Cloud instance as The SAP HANA database explorer provides the ability to browse catalog objects and execute SQL statements from the SQL console. For more information, see the tutorial group [Get Started with the SAP HANA Database Explorer](group.hana-cloud-get-started), [SQL Console](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sql-console) and [SAP HANA Database Explorer](https://help.sap.com/docs/hana-cloud/sap-hana-database-explorer/getting-started-with-sap-hana-database-explorer). - 3. Run the following query to see the name of the database you are currently connected to. ```SQL @@ -157,7 +151,8 @@ Continue with this tutorial once you have created an SAP HANA Cloud instance as Congratulations! You have connected to SAP HANA Cloud and performed a few queries. ### SAP HANA, express edition ->This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not setup an SAP HANA instance through the SAP HANA Cloud free tier as explained in step 3. + +>This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not set up an SAP HANA instance through the SAP HANA Cloud free tier as explained in step 3. SAP provides a free streamlined version of SAP HANA that runs on developer laptops called [SAP HANA, express edition](https://www.sap.com/products/technology-platform/hana/express-trial.html). @@ -171,9 +166,9 @@ Choose an option and proceed to install SAP HANA, express edition. The server-o At this point, you should have a running instance of SAP HANA, express edition. - ### Connect to SAP HANA, express edition ->This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not setup an SAP HANA instance using the SAP HANA Cloud free tier as explained in step 3. + +>This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not set up an SAP HANA instance using the SAP HANA Cloud free tier as explained in step 3. A default installation will contain one [system](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/39da3d057f56427ab1bb7f738ca9e7ce.html) database named **SYSTEMDB** and one [tenant](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/623afd167e6b48bf956ebb7f2142f058.html) database named **HXE**. @@ -181,10 +176,9 @@ The system database contains information about the tenant database(s) and is use The SAP HANA, express edition includes a command line tool (part of the SAP HANA client install) called [HDBSQL](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/c22c67c3bb571014afebeb4a76c3d95d.html) that can be used to query the database. - The following steps will demonstrate connecting to and examining a SAP HANA, express edition database. -1. Enter the following to connect to the system database: +1. Enter the following to connect to the system database: ```Shell hdbsql -n localhost:39013 -u SYSTEM -p Your_Password @@ -197,18 +191,20 @@ The following steps will demonstrate connecting to and examining a SAP HANA, exp The example above uses localhost since hdbsql is running on the same machine that the database is trying to connect to. The host name, `hxehost`, is seen in the terminal above. >If hdbsql is not found and you are logged in with another user, try connecting as the user `hxeadm` and run the command again. + ```Shell su hxeadm ``` + If the hdbsql command cannot be found, simply read through the following examples. The installation and further examples of running HDBSQL will be covered in subsequent tutorials. -2. Determine the IP address of the machine that is running SAP HANA, express edition. Record the value as it will be needed in later tutorials in the mission. It is important to note the IP address or host name of the machine, as this will be needed in later tutorials. +2. Determine the IP address of the machine that is running SAP HANA, express edition. Record the value as it will be needed in later tutorials in the mission. It is important to note the IP address or host name of the machine, as this will be needed in later tutorials. ```Shell ip addr ``` -3. The following are a some examples of [interactive options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/c24d054bbb571014b253ac5d6943b5bd.html) followed by a SQL query, which when run against **SYSTEMDB** returns information about the databases running on the SAP HANA instance. +3. The following are a some examples of [interactive options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/c24d054bbb571014b253ac5d6943b5bd.html) followed by a SQL query, which when run against **SYSTEMDB** returns information about the databases running on the SAP HANA instance. ```SQL \al on @@ -232,20 +228,20 @@ The following steps will demonstrate connecting to and examining a SAP HANA, exp If the SQL statement returns more than one screen of text, entering a space will show the next screen of results. See also the pager option `\pa`. -4. Enter one of the below commands to exit from viewing the results of the select statement. Note that commands can be prefixed with a forward slash(\\) or a colon(:). +4. Enter one of the below commands to exit from viewing the results of the select statement. Note that commands can be prefixed with a forward slash(\\) or a colon(:). ```HDBSQL \q :q ``` -5. Connect using the instance number and database name as shown below. +5. Connect using the instance number and database name as shown below. ```Shell hdbsql -n localhost -i 90 -d HXE -u SYSTEM -p Your_Password ``` -6. Enter the following to display database connection information. +6. Enter the following to display database connection information. ```HDBSQL \s @@ -257,8 +253,8 @@ The following steps will demonstrate connecting to and examining a SAP HANA, exp For further information, see [Port Assignment in Tenant Databases](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/440f6efe693d4b82ade2d8b182eb1efb.html) and [Connecting to SAP HANA Databases and Servers](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/b250e7fef8614ea0a0973d58eb73bda8.html). - ### Knowledge check + Congratulations! You now have access to an SAP HANA instance and understand some of the differences between SAP HANA Cloud and SAP HANA, express edition. ---- +--- \ No newline at end of file diff --git a/tutorials/hana-clients-choose-hana-instance/m-database.png b/tutorials/hana-clients-choose-hana-instance/m-database.png index 8aca002a27..43a012184e 100644 Binary files a/tutorials/hana-clients-choose-hana-instance/m-database.png and b/tutorials/hana-clients-choose-hana-instance/m-database.png differ diff --git a/tutorials/hana-clients-choose-hana-instance/select-user-schema.png b/tutorials/hana-clients-choose-hana-instance/select-user-schema.png index 9afdcb66a8..c273abbfb0 100644 Binary files a/tutorials/hana-clients-choose-hana-instance/select-user-schema.png and b/tutorials/hana-clients-choose-hana-instance/select-user-schema.png differ diff --git a/tutorials/hana-clients-entity-framework/hana-clients-entity-framework.md b/tutorials/hana-clients-entity-framework/hana-clients-entity-framework.md index 0d4de86ba8..0639140ac4 100644 --- a/tutorials/hana-clients-entity-framework/hana-clients-entity-framework.md +++ b/tutorials/hana-clients-entity-framework/hana-clients-entity-framework.md @@ -32,17 +32,17 @@ primary_tag: software-product>sap-hana-cloud The `dotnet` tool command can be used to install and manage tools that extend .NET. The following are a few examples that can be run to show help, to list the local and globally installed tools, to uninstall `dotnet-ef` if an incompatible version is installed, and to search the repository for version details of the `dotnet-ef` tool. ```Shell -dotnet tool -? -dotnet tool list -? +dotnet tool -h +dotnet tool list -h dotnet tool list dotnet tool list -g dotnet tool uninstall dotnet-ef -g dotnet tool search dotnet-ef --detail ``` -The SAP HANA Client 2.27 release supports EF Core 8.0 among other versions. For a list versions and support dates see [EF Core releases and planning](https://learn.microsoft.com/en-us/ef/core/what-is-new/) and SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810). +The SAP HANA Client 2.28 release supports EF Core 9.0 among other versions. For a list versions and support dates see [EF Core releases and planning](https://learn.microsoft.com/en-us/ef/core/what-is-new/) and SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810). -Run the following command to install version 8 of the dotnet-ef tool. +Run the following command to install version 9 of the dotnet-ef tool. ```Shell dotnet tool install dotnet-ef --version 9.0.14 -g @@ -141,7 +141,6 @@ dotnet ef -h Be sure to update the host URL and optionally the user name and password. Note that calls to 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. - 6. Open an editor to edit the file `Program.cs`. ```Shell (Windows) diff --git a/tutorials/hana-clients-golang/GoCreateJson.png b/tutorials/hana-clients-golang/GoCreateJson.png new file mode 100644 index 0000000000..ea989cf6a1 Binary files /dev/null and b/tutorials/hana-clients-golang/GoCreateJson.png differ diff --git a/tutorials/hana-clients-golang/GoJsonFile.png b/tutorials/hana-clients-golang/GoJsonFile.png new file mode 100644 index 0000000000..2942a07b6a Binary files /dev/null and b/tutorials/hana-clients-golang/GoJsonFile.png differ diff --git a/tutorials/hana-clients-golang/SetGoBreakpoint.png b/tutorials/hana-clients-golang/SetGoBreakpoint.png index aa06dbb91e..8912393d55 100644 Binary files a/tutorials/hana-clients-golang/SetGoBreakpoint.png and b/tutorials/hana-clients-golang/SetGoBreakpoint.png differ diff --git a/tutorials/hana-clients-golang/hana-clients-golang.md b/tutorials/hana-clients-golang/hana-clients-golang.md index e8feda70da..02aa7d1cb2 100644 --- a/tutorials/hana-clients-golang/hana-clients-golang.md +++ b/tutorials/hana-clients-golang/hana-clients-golang.md @@ -7,21 +7,26 @@ primary_tag: software-product>sap-hana-cloud --- # Connect Using the SAP HANA Go Interface + Create and debug a Go application that connects to SAP HANA using the SAP HANA client. ## Prerequisites - - You have completed the first 3 tutorials in this mission. + +- You have completed the first 3 tutorials in this mission. ## You will learn - - How to install Go - - How to create a Go application that queries a SAP HANA Database + +- How to install Go +- How to create a Go application that queries a SAP HANA Database ## Intro + 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/). --- ### Install Go + The first step is to check if Go is installed, and if so, which version. To do so, enter the following command: ```Shell @@ -41,6 +46,7 @@ On Linux, follow the instructions for the appropriate Linux version such as the >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. ### Configure the environment + The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, except for JDBC, makes use of a C library named SQLDBC. The Go driver loads the SQLDBC library named `libdbcapiHDB` using [`cgo`](https://golang.org/cmd/cgo/). For further information on the following steps, consult [Set Up Your Application to Use the Go Driver Package](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/fba20e31f75c4f7ca5629083869069e5.html) in the SAP HANA Client Interface Programming Reference Guide. A 64-bit `gcc` compiler is required. 1. To check if a 64-bit `gcc` compiler is installed, run the following command: @@ -67,7 +73,6 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, 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. - 2. Examine the Go environment by running the below command: ```Shell @@ -88,13 +93,18 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, ![hdbclient path env variable](hdbclient-path.png) - On Linux, add the following lines to the `.bash_profile`. + On Linux and Mac, add the corresponding following lines to the `.bash_profile`. - ```Shell (Linux or Mac) + ```Shell (Linux) export CGO_LDFLAGS=$HOME/sap/hdbclient/libdbcapiHDB.so export LD_LIBRARY_PATH=$HOME/sap/hdbclient ``` + ```Shell (Mac) + export CGO_LDFLAGS="$HOME/sap/hdbclient/libdbcapiHDB.dylib" + export DYLD_LIBRARY_PATH="$HOME/sap/hdbclient" + ``` + 4. Go to the driver folder and create a go module. ```Shell (Windows) @@ -108,9 +118,13 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, go mod init "SAP/go-hdb/driver" go mod tidy ``` + ![createModule](createModule.png) + The contents of the HANA Client folder is not writeable so you may need to change the permissions on the driver folder or copy files to a new location. + ### Create a Go application that queries an SAP HANA database + 1. In a shell, create a folder named `go`, enter the newly created directory, and open a file named `goQuery.go` in an editor. ```Shell (Microsoft Windows) @@ -124,6 +138,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, cd $HOME/HANAClientsTutorial/go pico goQuery.go ``` + 2. Add the code below to `goQuery.go`: ```Go Code @@ -131,8 +146,8 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, import ( "fmt" - "database/sql" - "log" + "database/sql" + "log" _ "SAP/go-hdb/driver" ) @@ -175,7 +190,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, err = rows.Err() if err != nil { - log.Fatal(err) + log.Fatal(err) } } ``` @@ -188,8 +203,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, go mod init "go/goQuery" go mod tidy notepad go.mod - ``` - + ``` ```Shell (Linux or Mac) go mod init "go/goQuery" @@ -197,7 +211,6 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, pico go.mod ``` - 4. Add the code below to `go.mod` under the go version line: >Make sure the path to the driver folder is correct and make any necessary changes. @@ -214,7 +227,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, ![go.mod contents](goModContents.png) -5. Run the application: +5. Place the dbcapi shared library files in /HANAClientsTutorial/go directory by copying or dragging them into that folder. Then, run the application: ```Shell go run goQuery.go @@ -225,6 +238,7 @@ The SAP HANA Client interface for Go, like the other SAP HANA client interfaces, For more information on the API's used, consult the SAP HANA connection specific properties at [Go Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/8d61ae225ae44b0bab2fb2285009f68d.html), [Go Database/SQL Tutorial](http://go-database-sql.org/index.html), and [Package SQL](https://golang.org/pkg/database/sql/). ### Debug the application + Visual Studio Code provides plugins for Go and can be used to debug an application. 1. If you have not already done so, download [Visual Studio Code](https://code.visualstudio.com/Download). @@ -239,11 +253,27 @@ Visual Studio Code provides plugins for Go and can be used to debug an applicati Visual Studio Code will recognize the `go` file extension and will suggest installing the Go for Visual Studio Code extension. Click **Install**. -4. Place a breakpoint. + Check whether a `launch.json` file has been created. If not, go to the Run and Debug tab and select “Create a launch.json file.” + + ![Go Create Json](GoCreateJson.png) + +4. Open the file `launch.json` and add the following code + + ```Go Code + "env": { + "CGO_LDFLAGS": "./libdbcapiHDB.dylib" + } + ``` + + ![Go Json File](GoJsonFile.png) + + Change `./libdbcapiHDB.dylib` to the correct file for your operating system: use `libdbcapiHDB.dylib` on macOS, `libdbcapiHDB.dll` on Windows, or `libdbcapiHDB.so` on Linux. Also ensure the dbcapi file has been copied or moved into this folder. + +5. Place a breakpoint. ![SetBreakpoint](SetGoBreakpoint.png) -5. Select **Run | Start Debugging**. +6. Select **Run | Start Debugging**. Notice that the program stops running at the breakpoint that was set. @@ -251,12 +281,10 @@ Visual Studio Code provides plugins for Go and can be used to debug an applicati ![Breakpoint](GoBreakpoint.png) - >Debugging can also be performed from the command line using [Delve](https://github.com/go-delve/delve ). - + >Debugging can also be performed from the command line using [Delve](https://github.com/go-delve/delve). ### Knowledge check -Congratulations! You have now created and debugged a Go application that connects to and queries an SAP HANA database. - +Congratulations! You have now created and debugged a Go application that connects to and queries an SAP HANA database. --- diff --git a/tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md b/tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md index 243870c12d..1ec61b07e3 100644 --- a/tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md +++ b/tutorials/hana-clients-hdbsql/hana-clients-hdbsql.md @@ -7,21 +7,26 @@ primary_tag: software-product>sap-hana-cloud --- # Create a User, Tables and Import Data Using SAP HANA HDBSQL + Use the command line tool HDBSQL to connect to a SAP HANA database, create a user, and create tables which will be used in subsequent tutorials in this mission. ## Prerequisites - - You have completed the first 2 tutorials in this mission. + +- You have completed the first 2 tutorials in this mission. ## You will learn - - How to connect to SAP HANA from a client machine using HDBSQL - - How to create a user, schema, tables and import data + +- How to connect to SAP HANA from a client machine using HDBSQL +- How to create a user, schema, tables and import data ## Intro + HDBSQL is used in this tutorial as it is part of the SAP HANA client install. HDBSQL is a basic tool for executing SQL scripts and providing an interface for interactive queries. Another option to execute SQL operations is the [SQL Console](hana-dbx-hcc) that is part of SAP HANA Cloud Central or the [SAP HANA database explorer](group.hana-cloud-get-started) which is part of an on-premise install of the SAP HANA Cockpit or a server + applications SAP HANA, express edition install. --- ### Connect to SAP HANA using hdbsql + This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/c22c67c3bb571014afebeb4a76c3d95d.html) from the SAP HANA client installation. 1. Copy and paste the following command to see the command line options and press the space bar to advance though the information. @@ -30,7 +35,7 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http hdbsql -h | more ``` -2. Connect to either SAP HANA Cloud or SAP HANA, express edition using host, port, and credentials. Details on where to find these values are covered in the third and fifth steps of the [first tutorial](hana-clients-choose-hana-instance) in this mission. +2. Connect to either SAP HANA Cloud or SAP HANA, express edition using host, port, and credentials. Details on where to find these values are covered in the third and fifth steps of the [first tutorial](hana-clients-choose-hana-instance) in this mission. - To connect to SAP HANA Cloud, see the following general command. @@ -71,9 +76,8 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http ![screenshot showing the allowlist](allowlist.png) An example of configuring this setting is shown in [Allow connections to SAP HANA Cloud instance from selected IP addresses — using the command line](https://blogs.sap.com/2020/10/30/allow-connections-to-sap-hana-cloud-instance-from-selected-ip-addresses-using-the-command-line/). - - - The SAP HANA Cloud, HANA database free tier instance will be automatically stopped overnight. That means you need to restart your instance before working with it each new day. + - The SAP HANA Cloud, HANA database free tier instance will be automatically stopped overnight. That means you need to restart your instance before working with it each new day. - Connections to a HANA Cloud instance must use encryption. The default encryption library on Windows is mscrypto and on Linux and macOS it is OpenSSL. The following example demonstrates how one could use the SAP provided conmmoncrypto library instead of the default encryption library. Note, the following steps require that the SAP HANA Client be downloaded from the SAP Software Downloads as the download includes the SAP Common Crypto library (libsapcrypto). Note that the environment variables can also be set by running source hdbclienv.sh or hdbclienv.bat. @@ -124,13 +128,13 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http ``` For additional details see [Server Certificate Authentication](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/a95754380f4c4c05b728524f9cd652e3.html). - + - 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`_ 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). - + It can be downloaded from [Download PEM](https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem), renamed to `trust.pem` and saved to the specified location. For further details, see [Secure connection from HDBSQL to SAP HANA Cloud](https://blogs.sap.com/2020/04/14/secure-connection-from-hdbsql-to-sap-hana-cloud/). 4. Type `\s` for status information @@ -143,13 +147,12 @@ This step demonstrates how to connect to a SAP HANA instance using [HDBSQL](http ![Connect to HANA Cloud](Connect-to-host-server-cloud.png) - Notice that for the HANA, express edition, the version number is 2.x. ![Connect to HXE](Connect-to-host-server.png) - ### Create user and schema + 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. @@ -168,6 +171,7 @@ On Linux or a Mac, turn off page by page scroll output. Also, consult the `-j` >The end of this tutorial contains SQL statements to delete the user, schema and objects created. This may be helpful if you wish to recreate the sample dataset used in this tutorial. To verify that the user was created, enter the following command. + ```SQL SELECT USER_NAME FROM USERS; ``` @@ -198,6 +202,7 @@ For further information on SQL to create a user or schema, see [CREATE USER Stat [Grant Statement(Access Control)](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/grant-statement-access-control), and [Privileges](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/privileges). ### Store connection details in secure user store (hdbuserstore) + Remembering and entering IP addresses, ports, user IDs and passwords can be difficult. [SAP HANA User Store](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/708e5fe0e44a4764a1b6b5ea549b88f4.html) offers a convenient means of storing this information and making it available to the SAP HANA client interfaces. 1. Exit out of `hdbsql` and type `hdbuserstore` to see a list of available commands such as Set, List and Delete. @@ -206,6 +211,7 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff \q hdbuserstore ``` + `hdbuserstore` is included with the install of the SAP HANA client. 2. Using `hdbuserstore`, specify a key named `USER1UserKey` that has the host, port and credentials. Details on where to find these values are covered in the third and fifth steps of the [first tutorial](hana-clients-choose-hana-instance) in this mission. @@ -228,9 +234,11 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff [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 + 1. Exit HDBSQL by entering \q. 2. Create a folder for the exercises in this tutorial, enter that directory, and begin editing a file named `hotel.sql`. + ```Shell (Microsoft Windows) mkdir %HOMEPATH%\HANAClientsTutorial\sql cd %HOMEPATH%\HANAClientsTutorial\sql @@ -442,9 +450,8 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff For further information, see [CREATE TABLE Statement](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/create-table-statement-data-definition) and [INSERT Statement](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/insert-statement-data-manipulation). - 5. Identifiers such as table names are automatically upper cased unless they are within "". - + ```SQL SELECT * FROM HoTeLs.RoOm; --succeeds SELECT * FROM "HoTeLs"."RoOm"; --fails @@ -453,7 +460,6 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff For further details, consult [Identifiers and case sensitivity](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/introduction-to-sql#loio209f5020751910148fd8fe88aa4d79d9__identifiers_case). - Should you wish to remove the contents of a table, the table itself, a schema or a user, the following statements can be executed. Do not execute these now as `USER1` and the hotel data set will be used subsequently in this tutorial. ```SQL @@ -464,6 +470,7 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff ``` ### Interactive, non-interactive, substitution variables, and prepared statements + 1. HDBSQL can [run commands](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/6097e699826343d0879244185d680a0d.html) interactively, or non-interactively. A few examples are shown below. ```SQL @@ -495,6 +502,7 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff ```Shell hdbsql -A -U USER1UserKey -V nameParam=J% -I findCustomers.sql ``` + The -V option specifies a named variable that can be used within the SQL specified after the -I option. ![example of substitution parameters](subst.png) @@ -526,10 +534,8 @@ Remembering and entering IP addresses, ports, user IDs and passwords can be diff In the above examples, the statements are prepared first, then the parameters are sent afterwards during the execute phase. In the previous step which used substitution variables, however, there is no separate prepare step. If a statement is going to be executed repeatedly, but with different parameters, in general, prepared statements can execute quicker. - ### Knowledge check -Congratulations! You have now created a user and some tables using HDBSQL. This user will be used to connect and query the data in the following tutorials. - +Congratulations! You have now created a user and some tables using HDBSQL. This user will be used to connect and query the data in the following tutorials. --- diff --git a/tutorials/hana-clients-install/Client-install.png b/tutorials/hana-clients-install/Client-install.png index 81afa74eff..0e7b5847fb 100644 Binary files a/tutorials/hana-clients-install/Client-install.png and b/tutorials/hana-clients-install/Client-install.png differ diff --git a/tutorials/hana-clients-install/hana-clients-install.md b/tutorials/hana-clients-install/hana-clients-install.md index 6f5746a1fb..aecd688832 100644 --- a/tutorials/hana-clients-install/hana-clients-install.md +++ b/tutorials/hana-clients-install/hana-clients-install.md @@ -7,21 +7,26 @@ primary_tag: software-product>sap-hana-cloud --- # Install the SAP HANA Client + Learn about the multiple ways to install the SAP HANA client. ## Prerequisites - - A Microsoft Windows, Mac, or Linux machine + +- A Microsoft Windows, Mac, or Linux machine ## You will learn - - How to install the SAP HANA client - - The two locations where SAP HANA client installs can be downloaded from + +- How to install the SAP HANA client +- The two locations where SAP HANA client installs can be downloaded from ## Intro + This tutorial will demonstrate how to install the SAP HANA client. The next tutorial in this mission will demonstrate how to use HDBSQL, which is a command line utility included with the client's installation, to connect to SAP HANA. The tutorials cover Microsoft Windows, Linux and Mac. If there are commands that are different depending on the platform, multiple sets of commands will be provided, and the title will say Shell (Microsoft Windows) or Shell (Linux or Mac). On Microsoft Windows, in this tutorial, the shell used is the Command Prompt. --- ### The SAP HANA Client + The SAP HANA client provides a set of utilities and drivers to connect to and query a SAP HANA database from multiple programming APIs, such as Node.js, Python or Java as shown below. ![drivers](drivers.png) @@ -32,8 +37,8 @@ For a list of newly added features, see [New and Changed Features in the SAP HAN The SAP HANA client can be used to connect to different versions of SAP HANA. For example, a `2.20.x` client can connect to SAP HANA Cloud or SAP HANA 2.0. For more information, see [SAP HANA client and server cross-version compatibility](https://launchpad.support.sap.com/#/notes/0001906576). - ### Install from SAP Development Tools + 1. Download the client installer for your platform (Microsoft Windows, Linux, or Mac) from the [SAP Development Tools](https://tools.hana.ondemand.com/#hanatools) website under the HANA tab and the SAP HANA Client 2.0 section. >An alternate location to download the client installer (SAP Software Center) is described in step 3 which includes the SAP Common Crypto library and additional platforms such as Windows 32-bit and AIX. SAP Software Center also may contain newer versions and patches before they are available on the SAP Development Tools site. @@ -42,12 +47,19 @@ The SAP HANA client can be used to connect to different versions of SAP HANA. F 2. On Microsoft Windows, unzip the downloaded file in a temporary location. - On Linux or a Mac, use the following: + On Linux, use the following: - ```Shell (Linux or Mac) + ```Shell (Linux) tar -zxvf hanaclient*.tar.gz ``` + On Mac, use the following: + + ```Shell (Mac) + hdiutil attach hanaclient-*.dmg + cd "/Volumes/SAP HANA Client" + ``` + 3. Start the graphical installer `hdbsetup` or use the command line installer `hdbinst`. ```Shell (Microsoft Windows) @@ -74,13 +86,13 @@ The SAP HANA client can be used to connect to different versions of SAP HANA. F ![using set to view environment variables](env-variables.png) - >For details on how to configure your path on a Mac see [this](https://blogs.sap.com/2020/04/03/quick-tip-how-to-add-hdbsql-to-a-path-on-macos/) blog post. + >For details on how to configure your path on a Mac see [this](https://blogs.sap.com/2020/04/03/quick-tip-how-to-add-hdbsql-to-a-path-on-macos/) blog post and proceed to sub-step 5. >--- >To configure your path on Linux: - >Open an editor to edit the file `.bash_profile`, `.profile`, or `.zshrc` (macOS with zsh). + >Open an editor to edit the file `.bash_profile`, `.profile`, or `.zshrc`. >```Shell (Linux or Mac) pico ~/.bash_profile @@ -109,7 +121,6 @@ The SAP HANA client can be used to connect to different versions of SAP HANA. F ![Clients Post Installation](Clients-post-installation.png) - 6. Run the following command in a newly opened shell to verify the installation succeeded and the path is correct. ```Shell @@ -122,14 +133,14 @@ The install from SAP Development Tools does not contain the SAP Cryptographic L The SAP Cryptographic Library is only required when client-side data encryption is used, for LDAP Authentication, or for cases where a preference is to use the SAP Common Crypto Library over the libraries provided by the OS. For more information, see the following: - - [Client-Side Data Encryption in the Security Guide](https://help.sap.com/docs/SAP_HANA_PLATFORM/b3ee5778bc2e4a089d3299b82ec762a7/d7dc0b57c68d442ebc2af3815d9ea11e.html) +- [Client-Side Data Encryption in the Security Guide](https://help.sap.com/docs/SAP_HANA_PLATFORM/b3ee5778bc2e4a089d3299b82ec762a7/d7dc0b57c68d442ebc2af3815d9ea11e.html) - - [Client-Side Data Encryption Guide](https://help.sap.com/docs/SAP_HANA_PLATFORM/a7bd9a05faca4d6f8d26b1848a00a578/101498bb299745b586007fcac404a966.html) - - - [Download and Install SAP Common Crypto Library in the SAP HANA Client Installation and Update Guide](https://help.sap.com/docs/SAP_HANA_CLIENT/8e208b44c0784f028b948958ef1d05e7/463d3ceeb7404eca8762dfe74e9cff62.html) +- [Client-Side Data Encryption Guide](https://help.sap.com/docs/SAP_HANA_PLATFORM/a7bd9a05faca4d6f8d26b1848a00a578/101498bb299745b586007fcac404a966.html) +- [Download and Install SAP Common Crypto Library in the SAP HANA Client Installation and Update Guide](https://help.sap.com/docs/SAP_HANA_CLIENT/8e208b44c0784f028b948958ef1d05e7/463d3ceeb7404eca8762dfe74e9cff62.html) ### Alternate Install Option, SAP Software Center + Another download location is the [SAP Software Center](https://me.sap.com/softwarecenter), which requires signing in before downloading. SAP Software Center provides the very latest version of the SAP HANA client as well as additional platforms such as 32-bit Windows and AIX. Versions of the SAP HANA client downloaded from here include the SAP Common Crypto Library. > For additional details on supported platforms, see SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810) and SAP Note [2938939 - SAP HANA Client Legacy Platforms](https://launchpad.support.sap.com/#/notes/2938939). @@ -150,9 +161,9 @@ Another download location is the [SAP Software Center](https://me.sap.com/softwa 2. Extract the software using SAPCAR. - The downloaded file is a `.sar` file and the utility SAPCAR is needed to extract it. SAPCAR can also be downloaded from SAP Software Center. + The downloaded file is a `.sar` file and the utility SAPCAR is needed to extract it. [SAPCAR](https://help.sap.com/docs/sap-cc/install-guide/downloading-sapcar-utility?locale=en-US) can also be downloaded from SAP Software Center. - The command to extract a `.sar` file is shown below. The command options are extract, verbose and file. + The command to extract a `.sar` file is shown below. The command options are extract, verbose and file. Make sure the `.sar` file you want to extract is in the same directory as the SAPCAR executable. ```Shell (Microsoft Windows Command Prompt) SAPCAR_1010-70006231.EXE -xvf IMDB_CLIENT*.SAR @@ -160,15 +171,15 @@ Another download location is the [SAP Software Center](https://me.sap.com/softwa ```Shell (Linux or Mac) chmod u+x SAPCAR - ./SAPCAR_1010-70006178.EXE -xvf IMDB_CLIENT*.SAR + ./SAPCAR -xvf IMDB_CLIENT*.SAR ``` -3. Install the software as shown in the previous step. +3. Install the software as shown in sub-step 3 of Install from SAP Development Tools. >For further information on SAPCAR or if you are having troubles using it, see [SAP HANA, SAPCAR, and macOS](https://blogs.sap.com/2020/03/18/sap-hana-sapcar-and-macos/). ### Knowledge check -Congratulations! You now have the SAP HANA client installed. +Congratulations! You now have the SAP HANA client installed. --- diff --git a/tutorials/hana-clients-jdbc/hana-clients-jdbc.md b/tutorials/hana-clients-jdbc/hana-clients-jdbc.md index 705072685a..caf9d85f39 100644 --- a/tutorials/hana-clients-jdbc/hana-clients-jdbc.md +++ b/tutorials/hana-clients-jdbc/hana-clients-jdbc.md @@ -7,25 +7,30 @@ primary_tag: software-product>sap-hana-cloud --- # Connect Using the SAP HANA JDBC Driver + Create and debug a Java application that connects to SAP HANA using the SAP HANA client. ## Prerequisites - - You have completed the first 3 tutorials in this mission. + +- You have completed the first 3 tutorials in this mission. ## You will learn - - How to install Java - - How to create and debug a Java application that queries an SAP HANA database - - How to connect to SAP HANA in `DBeaver` using the SAP HANA JDBC driver + +- How to install Java +- How to create and debug a Java application that queries an SAP HANA database +- How to connect to SAP HANA in `DBeaver` using the SAP HANA JDBC driver ## Intro + [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. --- ### Install a JDK + 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, please install it from SapMachine. To verify that the JDK is correctly set up, run the following: @@ -42,8 +47,20 @@ The following command will install Java on openSUSE Leap 15.5. sudo zypper install java-11-openjdk-devel ``` +On macOS, you can install Java 11 using Homebrew with the following command: + +```Shell (Mac) +brew install openjdk@11 +``` + +To make it visible to system tools and IDEs, you may need to run the following command: + +```Shell (Mac) +sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk +``` ### Examine the SAP HANA JDBC driver + The SAP HANA driver for JDBC is a [Multi-Release JAR file](https://openjdk.java.net/jeps/238) and as such supports multiple versions of Java. It is available in the client installation folder at `C:\SAP\hdbclient\ngdbc.jar` and in the maven repository at [MVN Repository - ngdbc](https://mvnrepository.com/artifact/com.sap.cloud.db.jdbc/ngdbc). ![maven](maven.png) @@ -66,20 +83,18 @@ The SAP HANA driver for JDBC is a [Multi-Release JAR file](https://openjdk.java. The trace options are further described at [JDBC Tracing and Trace Options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4033f8e603504c0faf305ab77627af03.html). - -3. Run the following and use either connection details stored in the user store or specify the connection details. +3. Run the following and use either connection details stored in the user store or specify the connection details. Details on where to find host, port, and credentials. are covered in the third and fifth steps of the [first tutorial](hana-clients-choose-hana-instance) in this mission. ```Shell (Windows) java -jar C:\SAP\hdbclient\ngdbc.jar -k USER1UserKey -o encrypt=True -o validatecertificate=false -c "SELECT * FROM HOTELS.CUSTOMER" ``` - + Alternatively, you may run ```Shell (Windows) java -jar C:\SAP\hdbclient\ngdbc.jar -u USER1,Password1 -n your_host:your_port -o encrypt=True -o validatecertificate=false -c "SELECT * FROM HOTELS.CUSTOMER" ``` - ```Shell (Linux or Mac) java -jar ~/sap/hdbclient/ngdbc.jar -u USER1,Password1 -n your_host:your_port -o encrypt=True -o validatecertificate=false -c "SELECT * FROM HOTELS.CUSTOMER" ``` @@ -88,8 +103,8 @@ The SAP HANA driver for JDBC is a [Multi-Release JAR file](https://openjdk.java. See [JDBC Command-Line Connection Options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/9ac4e1eedbbc4961bce0db6ad64b3612.html) for additional details on parameters of `ngdbc.jar`. - ### Create a Java application that queries SAP HANA + 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 the Notepad text editor. ```Shell (Microsoft Windows) @@ -163,6 +178,7 @@ See [JDBC Command-Line Connection Options](https://help.sap.com/docs/SAP_HANA_CL ```Command Prompt (Microsoft Windows) javac -cp C:\SAP\hdbclient\ngdbc.jar;. JavaQuery.java ``` + ```Powershell (Microsoft Windows) javac -cp "C:\SAP\hdbclient\ngdbc.jar;." JavaQuery.java ``` @@ -175,7 +191,8 @@ See [JDBC Command-Line Connection Options](https://help.sap.com/docs/SAP_HANA_CL ```Command Prompt (Microsoft Windows) java -classpath C:\SAP\hdbclient\ngdbc.jar;. JavaQuery - ``` + ``` + ```Powershell (Microsoft Windows) java -classpath "C:\SAP\hdbclient\ngdbc.jar;." JavaQuery ``` @@ -190,8 +207,8 @@ See [JDBC Connection Options in Java Code](https://help.sap.com/docs/SAP_HANA_CL See [Connect to SAP HANA Cloud via JDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/ff15928cf5594d78b841fbbe649f04b4.html) for additional details on the certificate used during the connection. - ### Debug the application + Visual Studio Code provides plugins for Java and can be used to debug an application. 1. If you have not already done so, download [Visual Studio Code](https://code.visualstudio.com/Download). @@ -219,6 +236,7 @@ Visual Studio Code provides plugins for Java and can be used to debug an applica ![VS Code Debugging](debugging.png) ### Browse SAP HANA using DBeaver + `DBeaver` is a free and open-source database tool and can be used with the SAP HANA JDBC driver. The following steps demonstrate how to configure `DBeaver` to connect to SAP HANA Cloud or SAP HANA, express edition using the JDBC driver. @@ -246,13 +264,7 @@ The following steps demonstrate how to configure `DBeaver` to connect to SAP HAN `DBeaver` can also be used to create an entity relationship (ER) diagram, perform a comparison of two selected objects, execute import and export operations, view spatial data on a map, and perform data analysis with its grouping and `calc` panels. ### Knowledge check -Congratulations! You have now created and debugged a Java application that connects to and queries an SAP HANA database and used the JDBC driver in `DBeaver`. - - - - - - +Congratulations! You have now created and debugged a Java application that connects to and queries an SAP HANA database and used the JDBC driver in `DBeaver`. --- diff --git a/tutorials/hana-clients-node/hana-clients-node.md b/tutorials/hana-clients-node/hana-clients-node.md index e3f62bb432..8c537777b2 100644 --- a/tutorials/hana-clients-node/hana-clients-node.md +++ b/tutorials/hana-clients-node/hana-clients-node.md @@ -7,24 +7,27 @@ primary_tag: software-product>sap-hana-cloud --- # Connect Using the SAP HANA Node.js Interface + Create and debug a Node.js application that connects to SAP HANA using the SAP HANA client. ## Prerequisites - - You have completed the first 3 tutorials in this mission. + +- You have completed the first 3 tutorials in this mission. ## You will learn - - How to install Node.js and the SAP HANA client Node.js driver - - How to create a Node.js application that queries a SAP HANA database - - How to use both the synchronous and asynchronous driver interfaces + +- How to install Node.js and the SAP HANA client Node.js driver +- How to create a Node.js application that queries a SAP HANA database +- How to use both the synchronous and asynchronous driver interfaces ## Intro + Node.js provides a JavaScript runtime outside of the browser and uses an asynchronous event driven programming model. For more details, see [Introduction to Node.js](https://nodejs.dev/en/learn). --- ### Install Node.js - Ensure you have Node.js installed and check its version. Enter the following command: ```Shell @@ -55,7 +58,6 @@ If Node.js is not installed, download the long-term support (LTS) version of Nod >docker run -it --name=nodealpine node:alpine /bin/bash >``` - ### Install SAP HANA client for Node.js from NPM Node.js packages are available using [NPM](https://www.npmjs.com/), which is the standard package manager for Node.js. @@ -77,7 +79,6 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the cd %HOMEPATH%\HANAClientsTutorial\node ``` - ```Shell (Linux or Mac) mkdir -p $HOME/HANAClientsTutorial/node cd $HOME/HANAClientsTutorial/node @@ -91,9 +92,7 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the ``` >The `hana-client` driver contains native libraries as shown below. - >![pre built libraries](prebuilt.png) - >When installed using NPM, the native libraries for all available platforms are downloaded. The following environment variable can be used to remove the other platforms reducing the size of the project. For additional details, see [Node.js Environment Variables](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/2dbfa39ecc364a65a6ab0fea9c8c8bd9.html). >```Shell (Microsoft Windows) @@ -101,6 +100,7 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the npm uninstall @sap/hana-client npm install @sap/hana-client >``` + > >```Shell (Linux or Mac) export HDB_NODE_PLATFORM_CLEAN=1 @@ -118,6 +118,13 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the cd %HOMEPATH%\HANAClientsTutorial\node npm install C:\SAP\hdbclient\node >``` + > + >```Shell (Linux or Mac) + cd ~/SAP/hdbclient/node + npm install + cd ~/HANAClientsTutorial/node + npm install ~/SAP/hdbclient/node + >``` >If you encounter an error about permissions, on Microsoft Windows, run or open the command prompt as an administrator, or use `sudo` on Linux or Mac. @@ -168,7 +175,6 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the >npm list @sap/hana-client >``` - ### Create a synchronous Node.js application that queries SAP HANA 1. Open a file named `nodeQuery.js` in an editor. @@ -296,6 +302,7 @@ Node.js packages are available using [NPM](https://www.npmjs.com/), which is the ``` ### Create a synchronous app that uses a connection pool + Connection pooling can improve performance when making multiple, brief connections to the SAP HANA database. The following sample makes two connections one after another without using a connection pool and then using a connection pool. It demonstrates how the time taken to make a connection with a connection retrieved from a pool is significantly shorter. 1. Open a file named `nodeQueryConnectionPool.js` in an editor. @@ -312,7 +319,6 @@ Connection pooling can improve performance when making multiple, brief connectio 2. Add the code below to `nodeQueryConnectionPool.js`. Note that the values for host, port, user name and password are provided by the previously configured `hdbuserstore` key USER1UserKey. Save the file when finished. - ```JavaScript 'use strict'; const { PerformanceObserver, performance } = require('perf_hooks'); @@ -406,7 +412,6 @@ Connection pooling can improve performance when making multiple, brief connectio See [Node.js Connection Pooling](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/e252ff9b2cb44dd9925901e39025ce77.html) for additional details. The example above uses a new API that was added in the 2.17 release. - ### Create an asynchronous app that uses callbacks Asynchronous programming enables non-blocking code execution which is demonstrated in the below example. @@ -425,7 +430,6 @@ Asynchronous programming enables non-blocking code execution which is demonstrat 2. Add the code below to `nodeQueryCallback.js`. Note that the values for host, port, user name and password are provided by the previously configured `hdbuserstore` key USER1UserKey. Save the file when finished. - ```JavaScript 'use strict'; var util = require('util'); @@ -508,7 +512,6 @@ Asynchronous programming enables non-blocking code execution which is demonstrat Notice that asynchronous method calls use callback functions. - ### Create an asynchronous app that uses promises The Node.js driver for the SAP HANA client added support for promises in the 2.11 release. The following example demonstrates this. Notice that there is less nesting of code then the previous example. @@ -526,7 +529,6 @@ The Node.js driver for the SAP HANA client added support for promises in the 2.1 ``` 2. Add the code below to `nodeQueryPromise.js`. Note that the values for host, port, user name and password are provided by the previously configured `hdbuserstore` key USER1UserKey. Save the file when finished. - ```JavaScript 'use strict'; @@ -607,7 +609,7 @@ The Node.js driver for the SAP HANA client added support for promises in the 2.1 } ``` -4. Run the app. +3. Run the app. ```Shell node nodeQueryPromise.js @@ -619,7 +621,6 @@ The Node.js driver for the SAP HANA client added support for promises in the 2.1 ### Debug the application - Visual Studio Code can run and debug a Node.js application. It is a lightweight but powerful source code editor which is available on Windows, macOS and Linux. 1. If required, download [Visual Studio Code](https://code.visualstudio.com/Download). @@ -638,8 +639,8 @@ Visual Studio Code can run and debug a Node.js application. It is a lightweight ![VS Code Debugging](debugging.png) - ### Use TypeScript + [TypeScript](https://www.typescriptlang.org/) is a superset of JavaScript that provides optional types, compile-time checking, and code completion when using a tool such as Visual Studio Code. The following step provides an example of using TypeScript with the SAP HANA client Node.js interface. 1. Examine the interface file which is located at `C:\SAP\hdbclient\node\lib\index.d.ts` in SAP HANA client versions 2.16 and higher. @@ -729,7 +730,6 @@ Visual Studio Code can run and debug a Node.js application. It is a lightweight >The major version of Node.js and the `@types/node` versions should match. If you need to uninstall `@types/node` and install a different version, an example is shown below of the commands to do so. - >```Shell >npm uninstall @types/node >npm install @types/node@18.15.11 @@ -762,10 +762,8 @@ Visual Studio Code can run and debug a Node.js application. It is a lightweight ![Running node application](node-query-ts-execute.png) - ### Knowledge check Congratulations! You have created and debugged a Node.js application that connects to and queries an SAP HANA database. - --- diff --git a/tutorials/hana-clients-odbc/hana-clients-odbc.md b/tutorials/hana-clients-odbc/hana-clients-odbc.md index f5dde67303..cca7605c5b 100644 --- a/tutorials/hana-clients-odbc/hana-clients-odbc.md +++ b/tutorials/hana-clients-odbc/hana-clients-odbc.md @@ -7,22 +7,26 @@ primary_tag: software-product>sap-hana-cloud --- # Connect Using the SAP HANA ODBC Driver + Connect to SAP HANA using an ODBC data source. ## Prerequisites - - You have completed the first 3 tutorials in this mission. +- You have completed the first 3 tutorials in this mission. ## You will learn - - How to create and test an SAP HANA ODBC data source - - How to use an ODBC data source in an application + +- How to create and test an SAP HANA ODBC data source +- How to use an ODBC data source in an application ## Intro + [Open Database Connectivity](https://en.wikipedia.org/wiki/Open_Database_Connectivity) (ODBC) provides an [API](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/odbc-api-reference?view=sql-server-ver15) for accessing databases. Database vendors provide ODBC drivers for their database products. An application written to the ODBC standard can be ported to other databases that also provide an ODBC interface. --- ### Configure a data source using Microsoft Windows ODBC Data Source Administrator + The ODBC Data Source Administrator lists the installed ODBC drivers and the configured data sources. 1. Open the administrator by entering ODBC after clicking on the Microsoft Windows start icon. @@ -64,15 +68,14 @@ The ODBC Data Source Administrator lists the installed ODBC drivers and the conf The user name `USER1` and password `Password1` can be entered when prompted for credentials. -9. Press OK to save the data source. +9. Press OK to save the data source. >Saved values can also be viewed using the Microsoft Windows registry editor under the key `Computer\HKEY_CURRENT_USER\Software\ODBC\ODBC.INI`. - For additional details see [Connect to SAP HANA via ODBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/66a4169b84b2466892e1af9781049836.html). - ### Configure a data source on Linux or Mac with unixODBC + The following instructions demonstrate how [unixODBC](http://www.unixodbc.org/) can be used to configure and test a data source on Linux or Mac. 1. On SUSE Linux, the YaST installer can be used to install unixODBC. @@ -119,11 +122,12 @@ The following instructions demonstrate how [unixODBC](http://www.unixodbc.org/) databasename = HXE ``` -6. unixODBC provides a basic SQL query tool called `isql` that can be used to validate a data source. +6. unixODBC provides a basic SQL query tool called `isql` that can be used to validate a data source. ```Shell (Linux or Mac) isql -v HANA_Cloud User1 Password1 ``` + Once you see a message that indicates a connection has been made, enter the following statement to verify this. ```Shell (Linux or Mac) @@ -132,8 +136,8 @@ The following instructions demonstrate how [unixODBC](http://www.unixodbc.org/) ![isql](isqlQuery.png) - ### Use a SAP HANA data source from another program + An application that supports ODBC can now make use of the created data source. One example on Windows is Microsoft Excel. >Microsoft Excel can be 32 or 64 bit. This can be seen under **File | Account | About Excel**. @@ -173,6 +177,7 @@ The following steps demonstrate how to use Microsoft Excel to query data in SAP For further information on programming an application to use the ODBC client driver, see [ODBC Application Programming](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/73f03d62240f435880ade3bc1242cc05.html). ### Knowledge check + Congratulations! You have configured an ODBC data source to contain connection information for a SAP HANA database and used that data source from Microsoft Excel. diff --git a/tutorials/hana-clients-python/hana-clients-python.md b/tutorials/hana-clients-python/hana-clients-python.md index 3241ab21cf..27984389c0 100644 --- a/tutorials/hana-clients-python/hana-clients-python.md +++ b/tutorials/hana-clients-python/hana-clients-python.md @@ -7,16 +7,20 @@ primary_tag: software-product>sap-hana-cloud --- # Connect Using the SAP HANA Python Interface + Create and debug a Python application that connects to SAP HANA using the SAP HANA client. ## Prerequisites - - You have completed the first 3 tutorials in this mission. + +- You have completed the first 3 tutorials in this mission. ## You will learn + - How to install Python and the SAP HANA client Python driver - How to create and debug a Python application that queries a SAP HANA database ## Intro + In the 2023 Stack Overflow's annual developer survey, Python ranked 3rd in the [Most popular technologies](https://survey.stackoverflow.co/2023/#most-popular-technologies-language) section. For further information on Python, see [Introduction to Python 3](https://realpython.com/python-introduction/) or [The Python Tutorial](https://docs.python.org/3/tutorial/). The following steps create a simple Python app that can connect to and query an SAP HANA database. @@ -24,6 +28,7 @@ The following steps create a simple Python app that can connect to and query an --- ### Install Python + The first step is to check if Python is installed. Enter the commands below. @@ -33,27 +38,28 @@ python --version python3 --version ``` -If Python is installed, the command will return a value such as Python 3.12.2. +If Python is installed, the command will return a value such as Python 3.13.3. If you are using Python 3, replace pip with pip3 in all commands throughout this tutorial to ensure packages are installed for the correct Python version. Details on supported versions of Python for the [SAP HANA client for Python](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f3b8fabf34324302b123297cdbe710f0.html) can be found at SAP Note [3165810 - SAP HANA Client Supported Platforms](https://launchpad.support.sap.com/#/notes/3165810). - If Python is not installed, it can be downloaded from [Python downloads](https://www.python.org/downloads/). -On Microsoft Windows, check the box that says **Add Python 3.x to PATH** as shown below to ensure that the interpreter will be placed in your path. +On Microsoft Windows, check the box that says **Add Python 3.x to PATH** as shown below to ensure that the interpreter will be placed in your path. ![python-install](install-python.png) You should now be able to open a new shell and verify that Python is installed. - ### Install SAP HANA client for Python using pip and PyPI + The standard package installer for Python is [pip](https://pypi.org/project/pip/). The following commands will check the version of pip and attempt to upgrade it to the latest available version. ```Shell pip --version -pip3 --version pip install --upgrade pip +or +pip3 --version +pip3 install --upgrade pip ``` >On Linux or Mac, if you encounter permission issues, one way to solve the issue is to use `sudo` before the command. @@ -126,8 +132,8 @@ pip install hdbcli > pip show hdbcli > ``` - ### Create Python application that queries SAP HANA + 1. In a shell, create a folder named `python`, enter the newly created directory, and open a file name `pythonQuery.py` in an editor. ```Shell (Microsoft Windows) @@ -219,14 +225,14 @@ pip install hdbcli The code in `pythonQuery.py` uses [PEP 249 -- Python Database API Specification](https://www.python.org/dev/peps/pep-0249/), which defines a set of methods that provide a consistent database interface, independent of the actual database being used. - - For further examples of accessing a database from Python, see [Python and SQL](https://www.python-course.eu/sql_python.php) and [Python MySQL](https://www.w3schools.com/python/python_mysql_insert.asp). - - - For information on the SAP HANA Python client, see [Python Application Programming](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f3b8fabf34324302b123297cdbe710f0.html). +- For further examples of accessing a database from Python, see [Python and SQL](https://www.python-course.eu/sql_python.php) and [Python MySQL](https://www.w3schools.com/python/python_mysql_insert.asp). - - For further details on secure connections from Python to SAP HANA see [Secure connection from Python to SAP HANA](https://blogs.sap.com/2020/05/07/secure-connection-from-python-to-sap-hana/). +- For information on the SAP HANA Python client, see [Python Application Programming](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f3b8fabf34324302b123297cdbe710f0.html). +- For further details on secure connections from Python to SAP HANA see [Secure connection from Python to SAP HANA](https://blogs.sap.com/2020/05/07/secure-connection-from-python-to-sap-hana/). ### Debug the application + Visual Studio Code provides plugins for Python and can be used to debug an application. 1. If you have not already done so, download [Visual Studio Code](https://code.visualstudio.com/Download). diff --git a/tutorials/hana-clients-python/install-python.png b/tutorials/hana-clients-python/install-python.png index 26821fb82d..18e5959cb9 100644 Binary files a/tutorials/hana-clients-python/install-python.png and b/tutorials/hana-clients-python/install-python.png differ diff --git a/tutorials/hana-clients-routing/hana-clients-routing.md b/tutorials/hana-clients-routing/hana-clients-routing.md index 9503a4aac7..2e7daa524d 100644 --- a/tutorials/hana-clients-routing/hana-clients-routing.md +++ b/tutorials/hana-clients-routing/hana-clients-routing.md @@ -52,7 +52,7 @@ The following steps demonstrate how a replica can be added to an SAP HANA Cloud ### Hint based routing -Individual read only queries can be routed to the replica. There are some conditions such as the isolation level must be read commited. Further details can be found at [Hint-Based Statement Routing for Active/Active (Read Enabled)](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/a6aa1cc4e070420c97e31fb1afd2ad3d.html). The following steps attempt to demonstrate this. +Individual read only queries can be routed to the replica. There are some conditions such as the isolation level must be read committed. Further details can be found at [Hint-Based Statement Routing for Active/Active (Read Enabled)](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/a6aa1cc4e070420c97e31fb1afd2ad3d.html). The following steps attempt to demonstrate this. 1. Verify the version of the SAP HANA client which needs to be 2.28 or higher by executing the below SQL. diff --git a/tutorials/hana-clients-trace/hana-clients-trace.md b/tutorials/hana-clients-trace/hana-clients-trace.md index 1022e16b5d..7d6f1ef6a9 100644 --- a/tutorials/hana-clients-trace/hana-clients-trace.md +++ b/tutorials/hana-clients-trace/hana-clients-trace.md @@ -7,16 +7,20 @@ primary_tag: software-product>sap-hana-cloud --- # Trace an SAP HANA Client Connection + Enable trace settings for applications using SAP HANA Client interfaces. ## Prerequisites - - You have completed the first 3 tutorials in this mission. + +- You have completed the first 3 tutorials in this mission. ## You will learn - - How to enable tracing using `hdbsqldbc_cons`, environment variables, or connection parameters - - How to direct trace details to a file, `stdout`, `stderr`, or to a callback + +- How to enable tracing using `hdbsqldbc_cons`, environment variables, or connection parameters +- How to direct trace details to a file, `stdout`, `stderr`, or to a callback ## Intro + Trace files can help SAP Support diagnose unexpected behavior. Tracing can be configured using executables included with the SAP HANA Client installation. [SQLDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/0c20691739094593855ece908b4a3cde.html)-based interfaces use `hdbsqldbc_cons`, except for [ODBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/35368f78f6884b019caee12c125b255a.html), which uses `hdbodbc_cons`. For [JDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4033f8e603504c0faf305ab77627af03.html), use `ngdbc.jar`. @@ -26,6 +30,7 @@ Trace settings can also be configured using environment variables, or via connec --- ### Enable Tracing + 1. Enter the following command to see the current trace settings: ```Shell @@ -100,6 +105,7 @@ Trace settings can also be configured using environment variables, or via connec ls -lt pico SQLDBC-####.txt ``` + ![Replace Process ID](ReplaceProcessID.png) Notice that the trace settings are shown at the top of the file. @@ -132,14 +138,13 @@ Trace settings can also be configured using environment variables, or via connec >If you are experiencing issues with SQLDBC tracing, consult [Troubleshooting SQLDBC Tracing](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/a1327e58f7c44d9e83972e6ea818dbe9.html). -5. Search through the trace file and notice the SQL statements that were executed. +5. Search through the trace file and notice the SQL statements that were executed. ``` ::PREPARE SQLCURS_1 2023-04-07 12:46:38.497000 [0x000002540c111af0] SQL COMMAND: SELECT VERSION FROM SYS.M_DATABASE ``` - 6. To turn off tracing for all categories, run the following command: ```Shell @@ -147,17 +152,17 @@ Trace settings can also be configured using environment variables, or via connec hdbsqldbc_cons SHOW ALL ``` - ### Additional Trace Settings + The following are some additional options for tracing. -1. The FLUSH setting, when turned on, can reduce I/O activity. If you are investigating a crash, it should be turned on to ensure that all the trace information is recorded. +1. The FLUSH setting, when turned on, can reduce I/O activity. If you are investigating a crash, it should be turned on to ensure that all the trace information is recorded. ```Shell hdbsqldbc_cons TRACE FLUSH ON ``` -2. Note that tracing should be turned off when not in use, as it does impact performance, memory and disk size. The following are some additional options to limit the trace file size to 100 KB (plus an archive file) and to turn on tracing only when a specific error code occurs. Error code 10 occurs when invalid credentials are used. +2. Note that tracing should be turned off when not in use, as it does impact performance, memory and disk size. The following are some additional options to limit the trace file size to 100 KB (plus an archive file) and to turn on tracing only when a specific error code occurs. Error code 10 occurs when invalid credentials are used. ```Shell hdbsqldbc_cons TRACE SIZE 100K @@ -168,7 +173,7 @@ The following are some additional options for tracing. ```SQL SELECT 'tracetestUSER1' FROM DUMMY; - CONNECT USER2 PASSWORD Password1; + CONNECT USER2 PASSWORD Password2; SELECT 'tracetestUSER2' FROM DUMMY; ``` @@ -183,7 +188,47 @@ The following are some additional options for tracing. The expected result is that the resulting trace file only traces the query from USER2. -4. In situations where `hdbsqldbc_cons` is not accessible, perhaps because a driver was installed directly using npm or pip, trace settings can be set using environment variables. The following values can be used in the trace file name. + While filtering by user is useful for isolating activity from a specific connection, it may still include multiple SQL statements. To further narrow the trace output, you can filter by a specific SQL statement using its hash value. + + To enable filtering by statement hash, you will need to obtain the MD5 value of the SQL statement. Update the sql.sql file with the following: + + ```SQL + SELECT 'tracetestUSER1' FROM DUMMY; + CONNECT USER2 PASSWORD Password2; + SELECT 'tracetestUSER2' FROM DUMMY; + SELECT * FROM HOTELS.CUSTOMER; + ``` + + To obtain the MD5 value, enter the following command: + + ```Shell + echo -n " SELECT * FROM HOTELS.CUSTOMER" | md5sum + ``` + + Ensure the SQL statement does not include a trailing semicolon (;) when calculating the MD5 hash. + + Execute the commands below to reset the trace settings, enable SQL to trace for the hash statement, and then to run the above SQL statements. + + ```Shell + hdbsqldbc_cons TRACE OFF + hdbsqldbc_cons TRACE SQL ON LEVEL INFO + hdbsqldbc_cons TRACE FILTER STATEMENT HASH "658d31bfb941b60f99decfbaf7f80b3f" + hdbsql -U User1UserKey -I sql.sql + ``` + + The expected result is that the resulting trace file only traces the specific SQL statement. + + Filtering can be done on the following categories: + + - APPLICATION USER + - CONNECTION ID + - SQL USER + - STATEMENT HASH + - STATEMENT + + >For more information, see [hdbsqldbc_cons Trace Options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/2f3ee8ed47e64ae48547f3a0a18c688c.html?locale=en-US). + +4. In situations where `hdbsqldbc_cons` is not accessible, perhaps because a driver was installed directly using npm or pip, trace settings can be set using environment variables. The following values can be used in the trace file name. * %p represents the process ID * %a represents the application user @@ -222,7 +267,7 @@ The following are some additional options for tracing. ![Environment Variable Values](EnvironmentVariable.png) -5. Trace information can be directed to `stdout` or `stderr`. See below for a few examples. +5. Trace information can be directed to `stdout` or `stderr`. See below for a few examples. ```Shell hdbsql -U User1UserKey -Z traceFile=stdout -Z traceOptions=sql=warning "SELECT * FROM HOTELS.CUSTOMER" @@ -236,11 +281,12 @@ The following are some additional options for tracing. set HDB_SQLDBC_TRACEFILE= ``` -6. Tracing can also be enabled in an application's connection properties. For further details see `traceFile` and `traceOptions` in [SQLDBC Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f6fb06ffe4484f6fa61f10082b11663d.html). - +6. Tracing can also be enabled in an application's connection properties. For further details see `traceFile` and `traceOptions` in [SQLDBC Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f6fb06ffe4484f6fa61f10082b11663d.html). ### Tracing a JDBC Connection + Java must be installed in order to complete the following steps. To check if it is installed, run the following commands: + ```Shell java -version javac -version @@ -262,15 +308,12 @@ javac -version java -jar C:\SAP\hdbclient\ngdbc.jar ``` - ```Shell (Linux or Mac) java -jar ~/sap/hdbclient/ngdbc.jar ``` - ![JDBC Driver GUI](JDBC-Driver-Trace-Config.png) - 2. Turn on the tracing for SQL statements using either the GUI or the commands below: ```Shell (Windows) @@ -279,7 +322,6 @@ javac -version java -jar C:\SAP\hdbclient\ngdbc.jar TRACE API ON ``` - ```Shell (Linux and Mac) java -jar ~/sap/hdbclient/ngdbc.jar TRACE ON java -jar ~/sap/hdbclient/ngdbc.jar TRACE FILENAME ~/tmp/traces/jdbctrace @@ -288,14 +330,17 @@ javac -version >The different command-line option keywords can be found at [JDBC Tracing and Trace Options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4033f8e603504c0faf305ab77627af03.html). -3. Execute a query which will generate a trace file. +3. Execute a query which will generate a trace file. - ```Shell + ```Shell (Windows) java -jar c:\sap\hdbclient\ngdbc.jar -k USER1UserKey -o encrypt=True -o validatecertificate=false -c "SELECT * FROM HOTELS.CUSTOMER" ``` -4. Examine the trace file by using the `cat` command (Linux or Mac) or the `type` command on Windows. + ```Shell (Linux and Mac) + java -jar ~/sap/hdbclient/ngdbc.jar -k USER1UserKey -o encrypt=True -o validatecertificate=false -c "SELECT * FROM HOTELS.CUSTOMER" + ``` +4. Examine the trace file by using the `cat` command (Linux or Mac) or the `type` command on Windows. ```

@@ -319,7 +364,7 @@ javac -version
     com.sap.db.jdbc.HanaStatement@117159c0.execute("SELECT * FROM HOTELS.CUSTOMER")
     ```
 
-5.  Tracing information can be sent to `stdout` or `stderr` as shown below.
+5. Tracing information can be sent to `stdout` or `stderr` as shown below.
 
     ```Shell (Windows)
     java -jar c:\sap\hdbclient\ngdbc.jar -k User1UserKey -o traceFile=stdout -o traceOptions=CONNECTIONS -c "SELECT * FROM HOTELS.CUSTOMER"
@@ -329,11 +374,10 @@ javac -version
     java -jar ~/sap/hdbclient/ngdbc.jar -k USER1UserKey -o traceFile=stdout -o traceOptions=CONNECTIONS -c "SELECT * FROM HOTELS.CUSTOMER"
     ```
 
-
-6.  Tracing can also be enabled via the connection parameters.  For further details see [Trace a JDBC Connection Using a Connection String](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/250544c4c9f74855862a40a78d4ee3b5.html).
+6. Tracing can also be enabled via the connection parameters.  For further details see [Trace a JDBC Connection Using a Connection String](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/250544c4c9f74855862a40a78d4ee3b5.html).
 
 ### Knowledge check
-Congratulations, you have now configured tracing with the SAP HANA client!
 
+Congratulations, you have now configured tracing with the SAP HANA client!
 
 ---
diff --git a/tutorials/hana-clients-x509/hana-clients-x509.md b/tutorials/hana-clients-x509/hana-clients-x509.md
index 52cac4b376..cfe23f5d5a 100644
--- a/tutorials/hana-clients-x509/hana-clients-x509.md
+++ b/tutorials/hana-clients-x509/hana-clients-x509.md
@@ -7,20 +7,24 @@ primary_tag: software-product>sap-hana-cloud
 ---
 
 # Authenticate to SAP HANA Cloud using X.509
+
 <!-- description --> Complete the provided steps to configure an SAP HANA Cloud, SAP HANA database instance to accept a login using an X.509 certificate.  Examples will be provided to connect from HDBSQL and a Node.js application on Microsoft Windows, Linux, or macOS.
 
 ## Prerequisites
- - Access to and administrative rights to an SAP HANA Cloud instance such as a free-tier or trial account
- - The SAP HANA Client installed on Microsoft Windows, Linux, or macOS
- - An installation of Node.js
+
+- Access to and administrative rights to an SAP HANA Cloud instance such as a free-tier or trial account
+- The SAP HANA Client installed on Microsoft Windows, Linux, or macOS
+- An installation of Node.js
 
 ## You will learn
-  - How to create a client X.509 certificate for a non productive or demo system
-  - How to configure SAP HANA Cloud to accept authentication requests using X.509
-  - How to use the client certificate in HDBSQL
-  - How to use the client certificate in a Node.js application
+
+- How to create a client X.509 certificate for a non-productive or demo system
+- How to configure SAP HANA Cloud to accept authentication requests using X.509
+- How to use the client certificate in HDBSQL
+- How to use the client certificate in a Node.js application
 
 ## Intro
+
 As described at [User Authentication Mechanisms](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/user-authentication-mechanisms), there are multiple methods to authenticate a user when connecting to an SAP HANA Cloud database.  A very common mechanism is a user name and password.  This tutorial demonstrates [X.509 Certificate-Based User Authentication](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/x-509-certificate-based-user-authentication).  
 
 X.509 certificates can be generated with a user supplied validity period, in addition to not being prone to phishing attacks. They can also be used in single sign-on environments and for technical users.  A self-signed certificate authority will be created and used to sign a client certificate.  An SAP HANA instance will be configured to trust certificates signed by the certificate authority.  On authentication, the provided client certificate is matched to a database user.
@@ -28,6 +32,7 @@ X.509 certificates can be generated with a user supplied validity period, in add
 ---
 
 ### Setup
+
 The SAP HANA Client can use different [cryptographic service providers](https://help.sap.com/docs/SAP_HANA_PLATFORM/b3ee5778bc2e4a089d3299b82ec762a7/2e7af7fcb38f4ac6a21d17440277bd52.html) on the operating systems shown below.  
 
 **Note**: these steps will vary slightly depending on the operating system and security library used.
@@ -53,7 +58,7 @@ As a first step, we will ensure that basic connectivity is working with a user n
     ![hdbsql version](hdbsql-version.png)
 
 2. Go to HANA Cloud Central and open a SQL console for your SAP HANA instance.
-   
+
     ![Open SQL console in HCC](open-sqlcons.png)
 
     Execute the following SQL to create a user to attempt to connect with.
@@ -70,15 +75,14 @@ As a first step, we will ensure that basic connectivity is working with a user n
     hdbsql -j -A -sslprovider mscrypto -u TESTUSER -p Password1 -Z traceFile=stdout -Z traceOptions=debug=warning,flush=on -n xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.hana.trial-us10.hanacloud.ondemand.com:443 "SELECT CURRENT_USER, CURRENT_SCHEMA FROM DUMMY;"
     ```
 
-
     ```Shell (Linux or Mac)
     hdbsql -j -A -sslprovider openssl -u TESTUSER -p Password1 -Z traceFile=stdout -Z traceOptions=debug=warning,flush=on -n xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.hana.trial-us10.hanacloud.ondemand.com:443 "SELECT CURRENT_USER, CURRENT_SCHEMA FROM DUMMY;"
     ```
 
     ![successful connection with user and password authentication](test-user-hdbsql.png)
 
-
 ### Create a demo certificate authority
+
 The following steps were performed on Linux (using WSL) with an installation of SAP HANA Client.  The result will be a directory named `certs` containing a private key and a public certificate for a new certificate authority.  In a non-demo environment, a trusted certification authority could be used instead.  
 
 1. Verify that OpenSSL is installed.
@@ -88,7 +92,7 @@ The following steps were performed on Linux (using WSL) with an installation of
     ```
 
     If OpenSSL is installed a value such as "OpenSSL 3.0.8 7 Feb 2023" will be shown.  
-    
+
     >On openSUSE Leap 15.5, the command is openssl-3.
 
     >LibreSSL will appear instead of OpenSSL when using macOS.
@@ -107,8 +111,8 @@ The following steps were performed on Linux (using WSL) with an installation of
 
     Further details on OpenSSL commands can be found at [OpenSSL commands](https://www.openssl.org/docs/man3.0/man1/). 
 
-
 ### Create a client certificate
+
 1. Create a private user key and a certificate signing request.
 
     ```Shell
@@ -119,7 +123,6 @@ The following steps were performed on Linux (using WSL) with an installation of
 
     ![create client certificate](user-csr.png)
 
-
 2. Create a client certificate that has been signed by the certificate authority.
 
     ```Shell
@@ -129,7 +132,6 @@ The following steps were performed on Linux (using WSL) with an installation of
 
     ![create client certificate](client-cert.png)
 
-
 3. Perform the following steps in your selected environment to verify that the user certificate has been signed by the certificate authority.
 
     ```Shell
@@ -171,8 +173,8 @@ The following steps were performed on Linux (using WSL) with an installation of
 
     Notice that the value of the ISSUER_DISTINGUISHED_NAME is slightly different than what was specified when the certificate authority was originally created.  The State or ST value is shown as SP.  Additional details on this can be found at [SAP Note: 2094102 - Certificate DName attributes mapping between RFC 2256 and the CommonCryptoLib](https://launchpad.support.sap.com/#/notes/2094102).  This becomes important in step 6 when an X.509 certificate provider is created.
 
-
 ### Create a PEM and Personal Security Environment (PSE) file for the SAP HANA Client
+
 The details of the client certificate needed for authentication will be stored in a [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) file when using OpenSSL or a Personal Security Environment (PSE) file when using SAP CommonCryptoLib.  A PSE can either be file based or be an object in the SAP HANA database.  The SAP HANA Client needs to be able to access certificate details when connecting to the database and hence needs the certificate details to be stored in a file.
 
 1. Create a PEM file for use with OpenSSL.
@@ -180,6 +182,7 @@ The details of the client certificate needed for authentication will be stored i
     ```Command Prompt
     cat test_x509_user.key test_x509_user.crt demorootca.crt > test_x509_user.pem
     ```
+
     ```Powershell
     Get-Content test_x509_user.key, test_x509_user.crt, demorootca.crt | Set-Content test_x509_user.pem
     ```
@@ -192,8 +195,8 @@ The details of the client certificate needed for authentication will be stored i
 
     Additional details on sapgenpse can be found by entering `sapgenpse -h or sapgenpse import_p8 -h`.
 
-
 ### Add the demorootca.crt to the CERTIFICATES table
+
 1. View the contents of the `demorootca.crt` file.
 
     ```Shell
@@ -214,6 +217,7 @@ The details of the client certificate needed for authentication will be stored i
     Further details can be found at [CREATE CERTIFICATE Statement](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/create-certificate-statement-system-management).
 
 ### Create an X.509 provider and Personal Security Environment (PSE)
+
 1. Execute the following queries in the SQL console.  
 
     ```SQL
@@ -234,6 +238,7 @@ The details of the client certificate needed for authentication will be stored i
     Further details can be found at [CREATE X509 PROVIDER Statement](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c1d3f60099654ecfb3fe36ac93c121bb/3b3163d6ad0f4eb9bd73c7c060f49649.html) and [CREATE PSE statement](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c1d3f60099654ecfb3fe36ac93c121bb/4d80bf63fc374a7f99be94d8ce70a07a.html).  
 
 ### Create a database user
+
 Execute the following SQL statement to create a database user.
 
 ```SQL
@@ -246,8 +251,9 @@ The above is known as an explicit mapping.  The common name, or CN value, in the
 Further details can be found at [CREATE USER Statement](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/create-user-statement-access-control).
 
 ### Connect using the SAP HANA database explorer using an X.509 certificate
+
 1. Open the SAP HANA database explorer.
-    
+
     ![open SAP HANA database explorer from SAP HANA Cloud Central](open-dbx.png)
 
 2. Choose to add an instance, select **SAP HANA Database**, and choose **Authenticate using an X.509 certificate**.
@@ -263,6 +269,7 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
     ![successful connection](dbx-cert-connection.png)
 
 ### Connect from a Linux or macOS Client with HDBSQL using X.509 and OpenSSL
+
 1. Use hdbsql to connect to a HANA instance using a certificate.  Adjust the location of the test_x509_user.pem and the host and port values accordingly.
 
     ```Shell (Linux or Mac)
@@ -271,7 +278,6 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
 
     ![successful connection using the client certificate](openSSL-linux.png)
 
-
     Some of the used connection options are summarized in the table below.  Further details can be found at [SAP HANA HDBSQL Options](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/c24d054bbb571014b253ac5d6943b5bd.html) and [SQLDBC Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f6fb06ffe4484f6fa61f10082b11663d.html)  
 
     |hdbsql Option |Description|
@@ -284,6 +290,7 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
     | authenticationX509 | A string containing the X509 certificate or the name of a file containing the X509 certificate |
 
 ### Connect from a Linux, macOS, or Microsoft Windows Client with HDBSQL using X.509 and SAP Cryptographic Library (CommonCryptoLib)
+
 1. A few steps are required to enable the usage of CommonCryptoLib such as the setting of an environment variable named SECUDIR to the location of the SAP HANA Client install and the creation of a personal security environment file that contains the root certificate of the SAP HANA Cloud database. Follow the steps documented in the tutorial [Create a User, Tables and Import Data Using SAP HANA HDBSQL](hana-clients-hdbsql) (in a note in step 1) to use commoncrtypo.
 
 2. Connect using CommonCryptoLib.
@@ -299,6 +306,7 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
     ![HDBSQL connection with commoncrypto](commoncrypto-linux.png)
 
 ### Connect from a Node.js app using X.509 and OpenSSL or CommonCryptoLib
+
 1. Create a folder named `nodeX509OpenSSL` and enter the newly created directory.
 
     ```Shell (Microsoft Windows)
@@ -365,7 +373,7 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
     ```
 
     >If you are using commoncrypto, be sure to replace the contents of `sslCryptoProvider` with `commoncrypto`.  
-          
+
     >The values for host, port, and pem can be retrieved from an `hdbuserstore` key, such as X509UserKey, or they can be specified in the application. Be sure to replace the placeholder SQL endpoint with the SQL endpoint of your instance.  Further details can be found at [hdbuserstore Commands](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/db46cfc4c5db4692aa84b46e357d47b8.html).
     >
     >```Shell
@@ -381,11 +389,11 @@ Further details can be found at [CREATE USER Statement](https://help.sap.com/doc
     ```
 
     ![Running nodeQuery.js](node-query.png)
-    
 
 6. Should you wish to use SAP CommonCryptoLib, make sure the changes in the previous step to set were completed and then change the parameter sslCryptoProvider from openssl to commoncrypto and the authenticationX509 parameter to point to the pse file.
 
 ### Cleanup (optional)
+
 If you wish to undo the steps in this tutorial, execute the following SQL and commands.
 
 ```SQL
@@ -408,7 +416,7 @@ rm *
 ```
 
 ### Knowledge check
-Congratulations! You have now used an X.509 client certificate when connecting to an SAP HANA Cloud database.
 
+Congratulations! You have now used an X.509 client certificate when connecting to an SAP HANA Cloud database.
 
 ---