14 hours ago - last edited 13 hours ago
When your SAP HANA Cloud database is in another Global Account or subaccount, which prevents the natural use of the HDI container for database object management, you need to follow the steps below to configure your SAP CAP application and achieve a successful connection.
It is essential to create a user-provided service using the Cloud Foundry command line. This is important because SAP CAP requires the service to have three specific tags to automatically determine which configuration to use.
Run the following command:
cf create-user-provided-service ups-database-external -t "hana,database,relational"
After creating the service via the command line, you need to specify the connection data in the service's JSON in SAP BTP.
The JSON should contain the following:
{
"encrypt": true,
"host": "your-hana-cloud-host",
"password": "your-password",
"port": "443",
"schema": "YOUR_SCHEMA_NAME",
"sslValidateCertificate": true,
"user": "your-username"
}
You need to tell SAP CAP which service to use to obtain the credentials. This is done by modifying your project's package.json or .cdsrc.json file.
Add or update the "requires" section as follows:
{
"requires": {
"db": {
"kind": "hana",
"credentials": {
"service": "ups-database-external"
}
},
"[production]": {
"auth": "xsuaa",
"db": {
"kind": "hana",
"credentials": {
"service": "ups-database-external"
}
},
"data": false
}
}
}
Since you are not using HDI for database object management, you need to remove all references and configurations related to HDI in your mta.yaml file or your project's deployment configurations.
This includes:
For your CAP application to take the specified credentials and configuration, you need to bind the provided service to your application's instance in SAP BTP.
You can do this in two ways:
After deploying the application, run the command:
cf bind-service your-application-name ubs-database-external
Then, restart your application:
cf restart your-application-name
Add the binding in your mta.yaml file so that it is performed automatically during deployment.
Example of how to define the binding in mta.yaml:
modules:
- name: your-application-name
type: nodejs
path: .
requires:
- name: ups-database-external
resources:
- name: ups-database-external
type: org.cloudfoundry.managed-service
parameters:
service: user-provided
service-name: ups-database-external
Since you are not using HDI, you need to manually deploy the database objects in your SAP HANA Cloud instance.
From your CDS models, generate the SQL scripts using the following commands:
cds compile db/ --to sql --src db cds compile srv/ --to sql --src srv
These commands generate SQL scripts from your model definitions in the db/ and srv/ directories.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.