pub struct Connector { /* private fields */ }Expand description
Builder data type to create Connection.
When a connection can be established only with username, password
and connect string, use Connection::connect instead.
Implementations§
source§impl Connector
impl Connector
sourcepub fn new<U, P, C>(username: U, password: P, connect_string: C) -> Connector
pub fn new<U, P, C>(username: U, password: P, connect_string: C) -> Connector
Create a connector
sourcepub fn privilege(&mut self, privilege: Privilege) -> &mut Connector
pub fn privilege(&mut self, privilege: Privilege) -> &mut Connector
§Examples
// connect system/manager as sysdba
let conn = Connector::new("system", "manager", "")
.privilege(Privilege::Sysdba)
.connect()?;sourcepub fn external_auth(&mut self, b: bool) -> &mut Connector
pub fn external_auth(&mut self, b: bool) -> &mut Connector
Uses external authentication such as OS authentication.
§Examples
let conn = Connector::new("", "", "")
.external_auth(true)
.connect()?;sourcepub fn prelim_auth(&mut self, b: bool) -> &mut Connector
pub fn prelim_auth(&mut self, b: bool) -> &mut Connector
Sets prelim auth mode to connect to an idle instance.
sourcepub fn new_password<P>(&mut self, password: P) -> &mut Connector
pub fn new_password<P>(&mut self, password: P) -> &mut Connector
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(dberr)) if dberr.code() == 28001 => {
// ORA-28001: the password has expired
Connector::new("scott", "tiger", "")
.new_password("jaguar")
.connect()?
}
Err(err) => return Err(err),
};sourcepub fn purity(&mut self, purity: Purity) -> &mut Connector
pub fn purity(&mut self, purity: Purity) -> &mut Connector
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.
sourcepub fn connection_class<S>(&mut self, connection_class: S) -> &mut Connector
pub fn connection_class<S>(&mut self, connection_class: S) -> &mut Connector
sourcepub fn app_context<T1, T2, T3>(
&mut self,
namespace: T1,
name: T2,
value: T3,
) -> &mut Connector
pub fn app_context<T1, T2, T3>( &mut self, namespace: T1, name: T2, value: T3, ) -> &mut Connector
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(username, password, connect_string)
.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");sourcepub fn events(&mut self, b: bool) -> &mut Connector
pub fn events(&mut self, b: bool) -> &mut Connector
Reserved for when advanced queuing (AQ) or continuous query notification (CQN) is supported.
sourcepub fn edition<S>(&mut self, edition: S) -> &mut Connector
pub fn edition<S>(&mut self, edition: S) -> &mut Connector
Specifies edition of Edition-Based Redefinition.
sourcepub fn driver_name<S>(&mut self, driver_name: S) -> &mut Connector
pub fn driver_name<S>(&mut self, driver_name: S) -> &mut Connector
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.
sourcepub fn stmt_cache_size(&mut self, size: u32) -> &mut Connector
pub fn stmt_cache_size(&mut self, size: u32) -> &mut Connector
Specifies the number of statements to retain in the statement cache. Use a value of 0 to disable the statement cache completely.
The default value is 20.
See also Connection::stmt_cache_size and Connection::set_stmt_cache_size
sourcepub fn connect(&self) -> Result<Connection>
pub fn connect(&self) -> Result<Connection>
Connect an Oracle server using specified parameters
Trait Implementations§
source§impl PartialEq for Connector
impl PartialEq for Connector
impl StructuralPartialEq for Connector
Auto Trait Implementations§
impl Freeze for Connector
impl RefUnwindSafe for Connector
impl Send for Connector
impl Sync for Connector
impl Unpin for Connector
impl UnwindSafe for Connector
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)