SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Connect Using the SAP HANA JDBC Driver

Create and debug a Java application that connects to SAP HANA using the SAP HANA client.

Overview

🎓 beginner 15 min. SAP HANA CloudBeginnerSAP HANA CloudSAP HANA DatabaseSAP HANAExpress EditionJava

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

Prerequisites

Prerequisites

  • You have completed the first 3 tutorials in this mission.

Steps

Intro

Java Database Connectivity (JDBC) provides an API 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.


Step 1 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.

An OpenJDK from SAP is available at SapMachine. 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:

Shell
java -version
javac -version

If these commands fail, ensure that the folder they are located in, is included in your path.

The following command will install Java on openSUSE Leap 15.5.

Shell
sudo zypper install java-11-openjdk-devel

On macOS, you can install Java 11 using Homebrew with the following command:

Shell
brew install openjdk@11

To make it visible to system tools and IDEs, you may need to run the following command:

Shell
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
Step 2 Examine the SAP HANA JDBC driver
+
Step 3 Create a Java application that queries SAP HANA
+
Step 4 Debug the application
+
Step 5 Browse SAP HANA using DBeaver
+
Step 6 Knowledge check
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Install a JDK 2. Examine the SAP HANA JDBC driver 3. Create a Java application that queries SAP HANA 4. Debug the application 5. Browse SAP HANA using DBeaver 6. Knowledge check

Learn more →