Add Databases to the SAP HANA Database Explorer
- How to add different database types in the SAP HANA database explorer
- Additional operations that can be performed on a database
Prerequisites
- An SAP HANA database such as SAP HANA Cloud free tier, trial or the SAP HANA, express edition that includes the SAP HANA database explorer
Database connections in the SAP HANA database explorer represent SAP HANA or data lake Relational Engine databases that you browse and interact with.
SQL consoles are associated with a database connection.

- Step 1
Databases defined in the SAP BTP cockpit or the SAP HANA cockpit can be opened in the SAP HANA database explorer.
- From SAP HANA Cloud Central, choose Open in SAP HANA Database Explorer.
You may be prompted to enter database login credentials at this point. Enter the DBADMIN or SYSTEM user credentials that were set when the database instance was created.
The credentials can be saved so they do not need to be re-entered if they are entered into the SAP HANA cockpit.
Notice that when the SAP HANA database explorer opens, the selected database is the one from the selected tile or administered database. Also note that the URL contains a
&databaseid=
.If this URL is saved as a bookmark, each time the page is opened, the matching database will be selected in the catalog browser.
Hover over the database to see a summary and note that the type is Cockpit Database.
- From SAP HANA Cloud Central, choose Open in SAP HANA Database Explorer.
- Step 2
Databases can also be added directly to the SAP HANA database explorer. To connect to an SAP HANA Cloud or on-premise database, the host, port, user name, and password must be provided.
-
In the SAP HANA database explorer, press the + button to add a new database.
-
For database type, choose SAP HANA Database.
An SAP HANA, express edition or on-premise database can have two types of databases; system and tenant. This is known as multitenant. System databases are used to manage one or more tenant databases and are only applicable to on-premise systems. For further details, see Server Architecture of Tenant Databases.
-
Provide the host, port, user name, password, and name to show in display. Below are instructions on how to obtain the host name and port number.
Remember to remove the colon and port number from the host name and add the port to the port field.
When connecting to an SAP HANA Cloud instance, the database connection must use TLS.
The public root certificate of the certificate authority (CA) that signed the SAP HANA Cloud instance’s server certificate is required. This certificate is likely already available in the system certificate store on the operating system and accessible by the browser, but if not, it can be pasted into the UI. For more information see Secure Communication Between SAP HANA Cloud and JDBC/ODBC Clients.
For a HANA Cloud database, the host and port values can be copied from SAP HANA Cloud Central.
If you are using an SAP HANA, express edition or on-premise database, the port numbers for a system or tenant database can be determined by running the following query against the System database.
SQLCopySELECT "DATABASE_NAME", "HOST", "SERVICE_NAME", "SQL_PORT" FROM SYS_DATABASES.M_SERVICES WHERE SQL_PORT != 0;
-
After pressing OK, a new database will appear whose type is SAP HANA Database.
Advanced options can be used to specify database properties.
An example of what can be configured is shown below.
isolationLevel=SERIALIZABLE;locale=fr_FR;schema=HOTEL;client=55
These values can be seen by opening a SQL console and noticing the schema that the database is using or by executing the following queries.
SQLCopySELECT * FROM M_SESSION_CONTEXT WHERE CONNECTION_ID=current_connection; SELECT * FROM SYS.M_CONNECTIONS WHERE CONNECTION_ID=current_connection; SELECT ISOLATION_LEVEL FROM PUBLIC.M_TRANSACTIONS where CONNECTION_ID = current_connection;
For additional details, see Add Instances to the SAP HANA Database Explorer and the SET Statement.
-
- Step 3
A data lake Relational Engine is a column oriented, disk based relational store that can be used to economically store data that is not updated frequently. Additional details can be found at What is SAP HANA Cloud, Data Lake.
-
A data lake can be added to an already created SAP HANA Cloud database that does not have a data lake already associated with it or it can be added as a standalone database.
Ensure that the allowed connections list is set to Allow all IP addresses.
-
In the SAP HANA database explorer, choose to add a new connection of type Data Lake Relational Engine.
The user name is HDLADMIN.
The connection details can be copied from the instance tile.
-
The catalog browser can be used to view database objects and a SQL Console can be opened to query the database.
SQLCopySELECT CURRENT USER FROM DUMMY; SELECT * FROM SYS.SYSINFO; SELECT * FROM SA_DB_PROPERTIES() WHERE UPPER(PropName) LIKE '%NAME%'; SELECT * FROM SYS.SYSOPTIONS WHERE UPPER("option") LIKE '%AUTO%' OR UPPER("option") LIKE '%COMM%' OR UPPER("option") LIKE '%ISOL%';
Diagnostic files can also be viewed in the Logs directory.
-
- Step 4
A data lake Files container provides storage for non structured files such as images or PDF documents. It can also store structured files such as CSV, parquet, or ORC files and with the use of SQL on Files, queries can be performed on the data contained in those files. An example of using the data lake Files container is shown as a target for an export operation at Export and Import Data and Schema with SAP HANA Database Explorer.
-
A connection can be added to a data lake Files container. A data lake Files container is not currently available in the free tier or trial instances of SAP HANA Cloud.
Additional details on how to configure the data lake Files container including the certificates and how to perform queries using SQL on Files can be found at Managing Data Lake Files and Getting to know SAP HANA data lake Files.
-
Once added, the contents of the file container can be browsed. Files can be added, deleted or viewed.
When files are added, if a path is specified that does not exist, it will create the necessary folders.
-
- Step 5
Databases have additional actions that can be performed on them such as renaming, connecting as a different user, changing the connection of a SQL console, and viewing an overview of the connected database.
To rename a connection, right-click a database and choose Properties.
You may wish to rename the default database display name. Press OK to save the changes and close the window.
To connect to the same database but with different credentials, right-click a database and choose Add Database with Different User. This can be useful when you wish to connect to the same SAP HANA database but with a different set of credentials perhaps because you need elevated permissions. The USER1 database user will be created in the next tutorial.
When a SQL console opens, it connects to the currently selected database connection and displays the current schema and connection.
It is possible to connect, disconnect, or change the connection via the toolbar items highlighted above.
Subsequent tutorials assume the connected user is DBADMIN or SYSTEM.
To see information about an SAP HANA database, right-click a database and choose Show Overview. This provides a quick overview of the database that you are connected to including the database version.
Groups and filters can be used to organize and quickly find databases.
These groups are separate from the mechanism used in the on-premise SAP HANA Cockpit Manager or the groups seen in Run SQL on Multiple Databases dialog which use groups based on the cloud foundry space name for SAP HANA Cloud instances. For further details, see step 7.
- Step 6
An SAP HANA database can be set to have a specified usage, such as development or production. The following SQL statements will display the current usage value and then change it to production.
SQLCopySELECT * FROM M_INIFILE_CONTENTS WHERE KEY = 'usage'; ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'DATABASE') SET ('system_information', 'usage') = 'production' WITH RECONFIGURE;
After refreshing the page, there will be indicators that the database instance being worked with is a production database as shown below and care should be taken before executing operations that may affect performance or make unintentional changes to the database.
For additional details on this parameter, see the
system_information
usage parameter in SAP HANA Configuration Parameter Reference.To undo this setting, execute the SQL below.
SQLCopyALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'DATABASE') SET ('system_information', 'usage') = 'custom' WITH RECONFIGURE;
- Step 7
SAP HANA cockpit databases can be grouped together. This enables SQL statements to be run against a group of databases.
With SAP HANA Cloud, all databases created in a space are placed in a group. As seen below, the space name is dev.
SAP BTP Cockpit or SAP HANA Cloud Central contain in their URL, a parameter that indicates the unique name (GUID) for the space.
https://host/trial/#/globalaccount/GUID/subaccount/GUID/org/GUID/space/GUID/hanaCloud
The spaces that contain SAP HANA Cloud instances appear when running SQL against multiple databases. Executing commands in the SQL console will be covered in a subsequent tutorial.
The space dev is represented by its GUID in the selection dialog below.
With SAP HANA, express edition or an on-premise install, a tool called SAP HANA Cockpit Manager can be used to register databases and organize them into groups.
Two user defined groups are shown below.
These groups appear when running SQL against multiple databases. There are also three predefined groups named DEVELOPMENT, ALL, and PRODUCTION.
The ability to see groups in the SAP HANA database explorer that have been created using the SAP HANA Cockpit Manager requires the SAP HANA database explorer to be opened from the SAP HANA cockpit.
- Step 8
An SAP HANA Deployment Infrastructure (HDI) container can be created by using SAP Business Application Studio or the SAP HANA Web IDE. An HDI container can contain database objects such as tables, views, functions, stored procedures, and calculation views. HDI containers support the use case where multiple versions of the same data model are deployed into the same database instance. This might be done by multiple developers working on a project. Using HDI helps ensure a consistent deployment. Objects within an HDI container all share the same schema and are accessed by a technical user. Further details can be found at SAP HANA Deployment Infrastructure in the Cloud.
The SAP Business Application Studio is the recommended tool for SAP HANA native application development with SAP HANA Cloud HANA databases while the SAP HANA Web IDE is the recommended tool for HANA 2.0 on-premise databases. For additional details see SAP Business Application Studio and SAP Web IDE Full-Stack.
The following steps demonstrate how to use the SAP Business Application Studio or the SAP HANA Web IDE to create and deploy an HDI container containing a table and then view container in the SAP HANA database explorer.
- Step 9
Open the SAP BTP cockpit and from the Service Marketplace under the subaccount level (named trial in the screenshot below) find and open the SAP Business Application Studio.
Create a new SAP HANA Native Application dev space.
Once the dev space is running, open it.
Set the cloud foundry org and space by pressing F1 or Ctrl + Shift + P to open the command palette. Search for the command CF Set Org and Space.
The endpoint value can be found in the SAP BPT Cockpit.
From the Welcome tab (can be opened from the command palette if it is not open), choose Start from template.
Select SAP HANA Database Project.
Provide the following values and click Finish.
Setting Value Project name: myHANAProj
Module name: db
Namespace: Schema name: mySchema
SAP HANA Database Version: HANA Cloud Bind database Yes Once the project generation finishes, open the tool palette (F1) and choose SAP HANA: Create SAP HANA Database Artifact. Provide the following values and click Create.
Setting Value Path: /home/user/projects/myHANAProj/db/src
Version: HANA Cloud Artifact Type: Table (hdbtable)
Name: myTable
Paste the below content into the file.
SQLCopyCOLUMN TABLE myTable ( "ID" INTEGER, "VALUE" VARCHAR(50) )
Use the SAP HANA Projects Explorer to deploy the table.
Open the SAP HANA database explorer to view the deployed HDI container and table.
A new HDI container with the table is shown.
- Step 10
-
Open SAP HANA Web IDE for SAP HANA if using SAP HANA, express edition or an on-premise install.
An alternative way to determine the URL for the SAP Web IDE for SAP HANA is to run the below command on the machine where SAP HANA on-premise is installed.
ShellCopysu hxeadm xs apps
The user name for login is
XSA_ADMIN
. -
Ensure that the SAP HANA extensions are enabled.
-
Open the development pane.
-
Create a new HANA database project.
Right-click Workspace and choose New | Project from Template.
Select the template SAP HANA Database Application.
Fill in the following values and press Finish.
Setting Value Project Name: myHANAProj
Space: development Namespace: Clear the default value SAP HANA Database Version: Choose the appropriate version such as 2.0 SPS 06 -
After the wizard finishes, create a table by right-clicking on the
src
folder and choosing New | Database Artifact.Specify a file name of
test
and a file type of.hdbtable
.Paste the below content into the file and choose File | Save.
SQLCopyCOLUMN TABLE test ( "ID" INTEGER, "VALUE" VARCHAR(50) )
-
Deploy the HDI container. Right-click the db folder and choose Build | Build.
The Console window will show the result of the build process.
-
Once complete, the HDI container can be opened in the SAP HANA database explorer by right-clicking on the db folder and choosing Open HDI Container.
Alternatively, it can be added via the Add Database dialog.
Notice, above, that a user name and password are not requested. The connection will use a technical user, which was generated when the HDI container was created.
In the database browser and in the SQL console, notice that the schema name is not shown.
It is also possible to connect to an HDI container as an admin, which enables the ability to grant additional permissions in the HDI container. For an example of where this might be used, see Grant a Support User Access to an SAP HDI Container. Do not use the Admin connection to perform DDL (such as create, update, or delete) operations.
For an example of creating a calculation view inside an HDI container, see the video titled Develop Apps at the end of the blog post Getting Started with SAP HANA Cloud II | Basics
The mission Get Started with XS Advanced Development provides further examples of using an HDI container.
-
- Step 11
Congratulations! You have added different databases to the SAP HANA database explorer.
In the next tutorial, additional tables, views, functions, and procedures that will be used in subsequent tutorials in this group will be created directly in the database rather than in an HDI container.
Which of the following are operations that can be performed on an SAP HANA database explorer connection?
- Add an SAP HANA cockpit database connection
- Add an SAP HANA database connection
- Add a data lake Relational Engine database
- Add a data lake Files container (Optional)
- Additional database connection features
- Database usage
- Database groups (Optional)
- Native HANA development with HDI (Optional)
- Create and deploy an HDI container with the SAP Business Application Studio (Optional)
- Create and deploy an HDI container with the SAP HANA Web IDE (Optional)
- Knowledge check