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 Trial as explained in step 3.
A default installation will contain one system database named SYSTEMDB and one tenant database named HXE.
The system database contains information about the tenant database(s) and is used for overall administration. The default port for the system database is 39013. Later in this tutorial mission, a connection to the tenant database will be made and tables will be created and populated with data. For more information, see SAP HANA Tenant Databases Operations Guide.
The SAP HANA, express edition VM install includes a command line tool (part of the SAP HANA client install) called HDBSQL that can be used to query the database.
The following steps will demonstrate connecting to and examining a SAP HANA, express edition database.
-
Enter the following to connect to the system database:
hdbsql -n localhost:39013 -u SYSTEM -p Your_Password
Notice that the database being connected to is SYSTEMDB.
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.
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.
-
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 this mission. It is important to note the IP address or host name of the machine, as this will be needed in later tutorials.
ip addr
-
The following are a couple examples of interactive options followed by a SQL query, which when run against SYSTEMDB returns information about the databases running on the SAP HANA instance.
\al
\s
SELECT * FROM SYS_DATABASES.M_SERVICES WHERE SQL_PORT != 0;
The \al
or align interactive option when enabled increases the readability of the output.
The \s
command shows status information. It shows that that the SAP System Identification (SID) is HXE, that the connected database is SYSTEMDB, and the currently logged in user is SYSTEM.
The result of the SELECT against the M_SERVICES table shows that there are two databases, named SYSTEMDB and HXE and that they are accessible on ports 39013 and 39015.
The instance number can be derived from a port number using the second and third numbers in the port number 39013. In this case, the instance number is 90.
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
.
-
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(:).
\q
:q
-
Connect using the instance number and database name as shown below.
hdbsql -n localhost -i 90 -d HXE -u SYSTEM -p Your_Password
-
Enter the following to display database connection information.
\s
Notice that this time the database connected to is HXE.
For further information, see Port Assignment in Tenant Databases and Connecting to SAP HANA Databases and Servers.
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.