[−][src]Struct tiberius::Config
The Config
struct contains all configuration information
required for connecting to the database with a Client
. It also provides
the server address when connecting to a TcpStream
via the
get_addr
method.
When using an ADO.NET connection string, it can be
constructed using the from_ado_string
function.
Implementations
impl Config
[src]
pub fn new() -> Self
[src]
Create a new Config
with the default settings.
pub fn host(&mut self, host: impl ToString)
[src]
A host or ip address to connect to.
- Defaults to
localhost
.
pub fn port(&mut self, port: u16)
[src]
The server port.
- Defaults to
1433
.
pub fn database(&mut self, database: impl ToString)
[src]
The database to connect to.
- Defaults to
master
.
pub fn instance_name(&mut self, name: impl ToString)
[src]
The instance name as defined in the SQL Browser. Only available on Windows platforms.
If specified, the port is replaced with the value returned from the browser.
- Defaults to no name specified.
pub fn encryption(&mut self, encryption: EncryptionLevel)
[src]
Set the preferred encryption level.
- With
tls
feature, defaults toRequired
. - Without
tls
feature, defaults toNotSupported
.
pub fn trust_cert(&mut self)
[src]
If set, the server certificate will not be validated and it is accepted as-is.
On production setting, the certificate should be added to the local key storage, using this setting is potentially dangerous.
- Defaults to
false
.
pub fn authentication(&mut self, auth: AuthMethod)
[src]
Sets the authentication method.
- Defaults to
None
.
pub fn get_addr(&self) -> String
[src]
Get the host address including port
pub fn from_ado_string(s: &str) -> Result<Self>
[src]
Creates a new Config
from an ADO.NET connection
string.
Supported parameters
All parameter keys are handled case-insensitive.
Parameter | Allowed values | Description |
---|---|---|
server | <string> | The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name. The correct form of this parameter is either tcp:host,port or tcp:host\\instance |
IntegratedSecurity | true ,false ,yes ,no | Toggle between Windows authentication and SQL authentication. |
uid ,username ,user ,user id | <string> | The SQL Server login account. |
password ,pwd | <string> | The password for the SQL Server account logging on. |
database | <string> | The name of the database. |
TrustServerCertificate | true ,false ,yes ,no | Specifies whether the driver trusts the server certificate when connecting using TLS. |
encrypt | true ,false ,yes ,no | Specifies whether the driver uses TLS to encrypt communication. |
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,