Struct hdbconnect::ConnectParams
source · pub struct ConnectParams { /* private fields */ }
Expand description
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
- using an implementation of
IntoConnectParams
- implementations are provided for URLs that are represented as
String
or asUrl
- implementations are provided for URLs that are represented as
- the shortcut
ConnectParams::from_file
reads the URL from a file
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>
is used to specify the client’s locale
client_locale_from_env
: if<value>
is 1, the client’s locale is read from the environment variabe LANG
tls_certificate_dir
: the<value>
points to a folder with pem files that contain the server’s certificates; all pem files in that folder are evaluated
tls_certificate_env
: the<value>
denotes the environment variable that contains the server’s certificate
The client locale is used in language-dependent handling within the SAP HANA database calculation engine.
If you want to provide the server certificate directly, then
Example
use hdbconnect::IntoConnectParams;
let conn_params = "hdbsql://my_user:my_passwd@the_host:2222"
.into_connect_params()
.unwrap();
Implementations§
source§impl ConnectParams
impl ConnectParams
sourcepub fn builder() -> ConnectParamsBuilder
pub fn builder() -> ConnectParamsBuilder
Returns a new builder for ConnectParams.
sourcepub fn from_file<P: AsRef<Path>>(path: P) -> HdbResult<ConnectParams>
pub fn from_file<P: AsRef<Path>>(path: P) -> HdbResult<ConnectParams>
Reads a url from the given file and converts it into ConnectParams
.
sourcepub fn server_certs(&self) -> Option<&ServerCerts>
pub fn server_certs(&self) -> Option<&ServerCerts>
The ServerCerts.
sourcepub fn clientlocale(&self) -> &Option<String>
pub fn clientlocale(&self) -> &Option<String>
The client locale.
Trait Implementations§
source§impl Clone for ConnectParams
impl Clone for ConnectParams
source§fn clone(&self) -> ConnectParams
fn clone(&self) -> ConnectParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ConnectParams
impl Debug for ConnectParams
source§impl IntoConnectParams for ConnectParams
impl IntoConnectParams for ConnectParams
source§fn into_connect_params(self) -> HdbResult<ConnectParams>
fn into_connect_params(self) -> HdbResult<ConnectParams>
self
into a ConnectParams
.