Module hdbconnect::url

source ·
Expand description

Constants for use in connection URLs.

Database connections are initialized with an instance of ConnectParams. Instances of ConnectParams can be created using a ConnectParamsBuilder, or from a URL. (Also ConnectParamsBuilders can be created from a URL.)

Such a URL is supposed to have the form

<scheme>://<username>:<password>@<host>:<port>[<options>]

where

<scheme> = hdbsql | hdbsqls // for TCP or TLS connections, respectively
<username> = the name of the DB user to log on
<password> = the password of the DB user
<host> = the host where HANA can be found
<port> = the port at which HANA can be found on <host>
<options> = ?<key>[=<value>][{&<key>[=<value>]}]

Supported options are:

  • db=<databasename> specifies the (MDC) database to which you want to connect
  • client_locale=<value> is used in language-dependent handling within the SAP HANA database calculation engine
  • client_locale_from_env (no value) lets the driver read the client’s locale from the environment variabe LANG
  • <networkgroup> = a network group
  • no_compression disables the support for compression
  • the TLS options:
    • tls_certificate_dir=<value> points to a folder with pem files that contain certificates; all pem files in that folder are evaluated
    • tls_certificate_env=<value> denotes an environment variable that contains certificates
    • use_mozillas_root_certificates (no value) lets the driver use the root certificates from https://mkcert.org/
    • insecure_omit_server_certificate_check (no value) lets the driver omit the validation of the server’s identity. Don’t use this option in productive setups!

To configure TLS, use the scheme hdbsqls and at least one of the TLS options.

For a plain connection without TLS, use the scheme hdbsql and none of the TLS options.

§Examples

ConnectParams is immutable, the URL must contain all necessary information:

use hdbconnect::IntoConnectParams;

let conn_params = "hdbsql://my_user:my_passwd@the_host:2222"
    .into_connect_params()
    .unwrap();

ConnectParamsBuilder allows modifications before being converted into a ConnectParams:

use hdbconnect::ConnectParamsBuilder;
let conn_params = ConnectParamsBuilder::from("hdbsql://my_user@the_host:2222")
    .unwrap()
    .with_password("no-secrets-in-urls")
    .build()
    .unwrap();

Constants§