[][src]Struct hdbconnect::ConnectParams

pub struct ConnectParams { /* fields omitted */ }

An immutable struct with all information necessary to open a new connection to a HANA database.

An instance of ConnectParams can be created in various ways:

Using the builder

The builder allows specifying all necessary details programmatically.

Example with TLS

This example is not tested
use hdbconnect::{ConnectParams, ServerCerts};
let certificate: String = read_certificate();
let connect_params = ConnectParams::builder()
   .hostname("the_host")
   .port(2222)
   .dbuser("my_user")
   .password("my_passwd")
   .tls_with(ServerCerts::Direct(certificate))
   .build()
   .unwrap();

Using a URL

The URL is supposed to have the form

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

where

<scheme> = hdbsql | hdbsqls
<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>}]]

Special option keys are:

client_locale=<value> specifies the client locale
client_locale_from_env (no value): lets the driver read the client's locale from the environment variabe LANG
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): use the root certificates from https://mkcert.org/

The client locale is used in language-dependent handling within the SAP HANA database calculation engine.

Example

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

Reading a URL from a file

The shortcut ConnectParams::from_file reads a URL from a file and converts it into an instance of ConnectParams.

Methods

impl ConnectParams[src]

pub fn builder() -> ConnectParamsBuilder[src]

Returns a new builder for ConnectParams.

pub fn from_file<P: AsRef<Path>>(path: P) -> HdbResult<ConnectParams>[src]

Reads a url from the given file and converts it into ConnectParams.

pub fn server_certs(&self) -> Option<&ServerCerts>[src]

The ServerCerts.

pub fn host(&self) -> &str[src]

The host.

pub fn addr(&self) -> &str[src]

The socket address.

pub fn use_tls(&self) -> bool[src]

Whether TLS or a plain TCP connection is to be used.

pub fn dbuser(&self) -> &String[src]

The database user.

pub fn password(&self) -> &SecStr[src]

The password.

pub fn clientlocale(&self) -> Option<&String>[src]

The client locale.

Trait Implementations

impl IntoConnectParams for ConnectParams[src]

impl Clone for ConnectParams[src]

impl Debug for ConnectParams[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,