[][src]Struct oracle::Connector

pub struct Connector { /* fields omitted */ }

Builder data type to create Connection.

When a connection can be established only with username, password and connect string, use Connection.connect instead.

Implementations

impl Connector[src]

pub fn new<U, P, C>(username: U, password: P, connect_string: C) -> Connector where
    U: Into<String>,
    P: Into<String>,
    C: Into<String>, 
[src]

Create a connector

pub fn privilege(&mut self, privilege: Privilege) -> &mut Connector[src]

Set administrative privilege.

Examples

// connect system/manager as sysdba
let conn = Connector::new("system", "manager", "")
    .privilege(Privilege::Sysdba)
    .connect()?;

pub fn external_auth(&mut self, b: bool) -> &mut Connector[src]

Uses external authentication such as OS authentication.

Examples

let conn = Connector::new("", "", "")
    .external_auth(true)
    .connect()?;

pub fn prelim_auth(&mut self, b: bool) -> &mut Connector[src]

Sets prelim auth mode to connect to an idle instance.

See starting up a database.

pub fn new_password<P>(&mut self, password: P) -> &mut Connector where
    P: Into<String>, 
[src]

Sets new password during establishing a connection.

When a password is expired, you cannot connect to the user. A new password must be set by other user or set during establishing a connection.

Examples

Connect to user scott with password tiger. If the password is expired, set a new password jaguar.

let conn = match Connection::connect("scott", "tiger", "") {
    Ok(conn) => conn,
    Err(Error::OciError(ref dberr)) if dberr.code() == 28001 => {
        // ORA-28001: the password has expired
        Connector::new("scott", "tiger", "")
            .new_password("jaguar")
            .connect()?
    },
    Err(err) => panic!(err.to_string()),
};

pub fn purity(&mut self, purity: Purity) -> &mut Connector[src]

Sets session purity specifying whether an application can reuse a pooled session (Purity::Self_) or must use a new session (Purity::New) from DRCP pooled sessions.

pub fn connection_class<S>(&mut self, connection_class: S) -> &mut Connector where
    S: Into<String>, 
[src]

Sets a connection class to restrict sharing DRCP pooled sessions.

See here for more detail.

pub fn app_context<T1, T2, T3>(
    &mut self,
    namespace: T1,
    name: T2,
    value: T3
) -> &mut Connector where
    T1: Into<String>,
    T2: Into<String>,
    T3: Into<String>, 
[src]

Appends an application context.

See Oracle manual

This is same with DBMS_SESSION.SET_CONTEXT but this can set application contexts before a connection is established.

Examples

let conn = Connector::new("scott", "tiger", "")
              .app_context("CLIENTCONTEXT", "foo", "bar")
              .app_context("CLIENTCONTEXT", "baz", "qux")
              .connect()?;
let val = conn.query_row_as::<String>("select sys_context('CLIENTCONTEXT', 'foo') from dual", &[])?;
assert_eq!(val, "bar");
let val = conn.query_row_as::<String>("select sys_context('CLIENTCONTEXT', 'baz') from dual", &[])?;
assert_eq!(val, "qux");

pub fn tag<S>(&mut self, tag: S) -> &mut Connector where
    S: Into<String>, 
[src]

Reserved for when connection pooling is supported.

pub fn match_any_tag(&mut self, b: bool) -> &mut Connector[src]

Reserved for when connection pooling is supported.

pub fn events(&mut self, b: bool) -> &mut Connector[src]

Reserved for when advanced queuing (AQ) or continuous query notification (CQN) is supported.

pub fn edition<S>(&mut self, edition: S) -> &mut Connector where
    S: Into<String>, 
[src]

Specifies edition of Edition-Based Redefinition.

pub fn driver_name<S>(&mut self, driver_name: S) -> &mut Connector where
    S: Into<String>, 
[src]

Sets the driver name displayed in V$SESSION_CONNECT_INFO.CLIENT_DRIVER.

The default value is "rust-oracle : version number". Only the first 8 chracters "rust-ora" are displayed when the Oracle server version is lower than 12.0.1.2.

pub fn connect(&self) -> Result<Connection>[src]

Connect an Oracle server using specified parameters

Trait Implementations

impl Clone for Connector[src]

impl Debug for Connector[src]

impl PartialEq<Connector> for Connector[src]

impl StructuralPartialEq for Connector[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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