SAP HANA User Store (hdbuserstore)
The SAP HANA user store (hdbuserstore) is a tool installed with the SAP HANA client. Use it to store connection information to SAP HANA systems on the client so that client applications can connect to SAP HANA without users having to enter this information. It is typically used by scripts connecting to SAP HANA.
The SAP HANA user store is installed with the SAP HANA client package. After you install the SAP HANA client, the hdbuserstore program is located in one of the following directories:
- /usr/sap/hdbclient (Linux/UNIX)
- %SystemDrive%\Program Files\sap\hdbclient (Microsoft Windows)
The store runs on all platforms supported by SAP HANA client interfaces and SAP BASIS 7.20 EXT.
Managing the Secure Store
Connection information stored in the SAP HANA user store is saved in the secure store file SSFS_HDB.DAT.
|
Operating system |
Default location |
|---|---|
|
Microsoft Windows |
<%ALLUSERSPROFILE%>\.hdb\<host-identity>\<security-identifier(SID)>\SSFS_HDB.DAT |
|
UNIX |
<home-directory-of-effective-user-ID>/.hdb/<host-identity>/SSFS_HDB.DAT |
For Microsoft Windows systems:
- <%ALLUSERSPROFILE%> stores a path to profile settings for all users on the system. On Microsoft Windows Vista and later, the default value for this environment variable is C:\ProgramData.
- <host-identity> is determined as follows:
- If %HDB_USE_IDENT% is set, its value determines <host-identity>. %HDB_USE_IDENT% must only contain alphanumeric characters, underscores ( _ ), or dashes ( - ). If any other character is included in the value, the variable is ignored.
- If <computer-name> (as returned by GetComputerName()) is set, its value determines <host-identity>.
- <security-identifier(SID)> is the Windows Security Identifier of the user that created the Secure User Store.
- When connecting using a client, if the $SAPLOCALHOST environment variable is set, then its value determines <host-identity>.
For UNIX systems:
- <host-identity> is determined as follows:
- If $HDB_USE_IDENT is set, its value determines <host-identity>. $HDB_USE_IDENT must only contain alphanumeric characters, underscores ( _ ), or dashes ( - ). If any other character is included in the value, the variable is ignored.
- When storing or listing keys using the hdbuserstore tool, if <virtual-hostname> is set by using the -H command line option, then its value determines <host-identity>.
- The computer's <hostname> determines <host-identity>.
- When connecting using a client, if the $SAPLOCALHOST environment variable is set, then its value determines <host-identity>.
- If VIRTUALHOST connection property is set, its value determines <host-identity>.
- On Linux only, if <virtual-hostname> is specified on the client install command line (by using the -H flag with hdbinst), its value determines <host-identity>.
Use the HDB_USE_IDENT environment variable to store your hdbuserstore in one environment so that users on all hosts can connect to the SAP HANA database using the same secure store information.
If the SSFS_HDB.DAT path does not already exist, then the hdbuserstore program creates it.
The secure store's content is platform-dependent. You cannot copy the secure store from one platform to another.
Managing Connection Information
Use the hdbuserstore program to store and manage connection information in the secure store. For more information about the available commands, see hdbuserstore Commands.
The secure user store is user specific, so only the operating system user who owns the corresponding secure store file can access the secure store. However, it is possible, with the appropriate operating system privileges, to manage another user's secure store. This behavior is needed, for example, to manage the connection details for ABAP on Microsoft Windows since the application server is running under a different user (SAPService<SAPSID> instead of <SAPSID>adm).
Using Stored Connection Information
When the secure store is accessed in the context of the correct operating system user, you can open it with a user key.
| Client | How to Connect Using a Stored User Key |
|---|---|
| HDBSQL | Specify the key to be used with the -U or -Z connection option: hdbsql -U <KEY> or hdbsql -Z KEY=<KEY> |
| ODBC | Specify the user store key with the @ sign in your data source:servernode=@<KEY> |
| ABAP | Specifies the key DEFAULT by default |
| JDBC | Specify the <KEY> and <VIRTUALHOSTNAME> properties to read the secure store directly |
| Node.js | Specify the user store key with the @ sign in your data source:servernode=@<KEY> |
| Python | Specify the <USERKEY> (case sensitive) or the <KEY> (case insensitive) in the dbapi.connect function. For example,
dbapi.connect(<USERKEY>=<KEY>) |
| Go | Specify the <KEY>. For example,
hdb://user:password@localhost:30015?<KEY>=<VALIDKEY> |
| ADO.NET | Specify KEY=<key-name> to access the secure store. |
To access the store using JDBC, there are two connect options: key and virtualHostName. key is the hdbuserstore key that you use to connect to SAP HANA, while virtualHostName specifies the virtual host name. This option allows you to change where the hdbuserstore searches for the data and key files.
To connect, define the hdbuserstore key using the key connect option. JDBC only supports reading the key and data files for existing keys and using those keys to connect to SAP HANA.
Managing the Encryption Key
The initial default encryption key of the secure user store is automatically changed when the first entry is created.
In older revisions, password information contained in the secure user store may have been encrypted using the initial default encryption key. As of revision 102, this key is automatically changed the first time the SET or DELETE commands are executed. You can also change it explicitly by using the CHANGEKEY command. The SET and DELETE commands implicitly execute the CHANGEKEY command. For more information, see Change the Secure User Store Encryption Key in the SAP HANA Administration Guide.
If a user forgets the stored password, then you cannot recover that password because the system does not display passwords in a human-readable form.
Connecting to a Requested Tenant Database
You can associate a key with tenant database information for use in a connection attempt. The server keeps track of which tenant databases are assigned to which ports for a host in the system database. You should only supply the host name/port pair for the system database that you plan to connect to, with each host specification being one of the three master nameservers associated with the system. The database name, when supplied in a connection attempt, is used to query a system database that runs on a well-defined port.
A failover may occur if one or more hosts in the connection list is down. Only one database may be supplied to a port. Therefore, whichever database fails over first is the database that is assigned to the port.
hdbuserstore set <new-key> <host-name>:30013@<Tenant-DB-Name> <myusername> <mypassword>