Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application, based on CData JDBC Driver for SAP HANA XSA.Follow these steps:
- Add the driver JAR file to the classpath. The JAR file is located in the installation directory's lib subfolder. Ensure that the .lic file is located in the same folder as the JAR file.
- Provide the driver class. For example:
cdata.jdbc.saphanaxsa.SAPHanaXSADriver
- Provide the JDBC URL. For example:
jdbc:saphanaxsa:User=MyUser;Password=MyPassword;URL=https://hxehost:51027/euro.xsodata;
Or, if there is a conflict in your application between drivers using the same URL format, use this form to ensure that you are using the CData driver:
jdbc:cdata:saphanaxsa:User=MyUser;Password=MyPassword;URL=https://hxehost:51027/euro.xsodata;
Ensure that the URL starts with either jdbc:saphanaxsa: or jdbc:cdata:saphanaxsa:. The URL can include any of the connection properties in name-value pairs separated with semicolons.
SAP HANA XSA uses the OAuth authentication standard. Before connecting, it is necessary to establish an SAP HANA XSA OData Service. See Creating a Custom OAuth App for a guide.
To connect to SAP Hana XSA using password-based OAuth:
- OAuthClientId: Set this to the Client Id specified in the UAA service JSON file.
- OAuthClientSecret: Set this to the Client Secret specified in the UAA service JSON file.
- URL: Set this to the OData service endpoint.
- XSUAAURL: Set this to the UAA service url.
- User: Set your accounts username.
- Password: Set your accounts password
Once you've configured the OData Service, you can establish a connection using Custom Credentials.