dotConnect Universal Connection Strings
Connection strings are key to configuring and managing dotConnect Universal connections to SQL Server, Oracle, MySQL, PostgreSQL, SQLite, and other data sources. This article explores practical ways and examples for building effective dotConnect Universal connection strings.
SQL Server provider connection strings
To connect to a SQL Server database using dotConnect Universal, you need to create a UniConnection object with a connection string. For example, the connection string can include basic parameters such as Provider, Server, User ID, Password, Database, and LicenseKey, as shown below.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=SQL Server;" + "Server=127.0.0.1;" + "User ID=TestUser;" + "Password=TestPassword;" + "Database=TestDb;" + "LicenseKey=**********"); ...
Basic connection string properties for SQL Server | |
---|---|
Name | Description |
Provider | SQL Server. |
Database | The name of the database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The user's password. |
Server or Data Source | The name or network address of the instance of SQL Server to connect to. |
User ID | The name of the user to connect. |
However, dotConnect Universal supports numerous advanced connection string properties to fine-tune SQL Server database connections. These include settings for connection resilience, performance, optimization, security, or context management. The full list of such advanced properties is below.
Advanced connection string properties for SQL Server | |
---|---|
Name | Description |
Advanced | |
MultipleActiveResultSets | If true, multiple result sets can be returned and read from one connection. |
Network Library | The network library used to establish a connection to an instance of SQL Server. |
Packet Size | The size (in bytes) of the network packets used to communicate with an instance of SQL Server. |
Transaction Binding | The binding behavior of the connection to a System.Transactions transaction when enlisted. |
Type System Version | The server type system that the provider will expose through the DataReader. |
Connection Resiliency | |
ConnectRetryCount | The number of attempts to restore the connection. |
ConnectRetryInterval | The delay between attempts to restore the connection. |
Context | |
Application Name | The name of the application. |
Workstation ID | The name of the workstation connecting to SQL Server. |
Initialization | |
ApplicationIntent | The application workload type when connecting to a server. |
Asynchronous Processing | If true, enables the use of the asynchronous functionality in the .Net Framework Data Provider. |
Connect Timeout | The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. |
Current Language | The SQL Server Language record name. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Connection Reset | If true, indicates that the connection state is reset when the connection is removed from the pool. |
Enlist | If true, sessions in a Component Services (or MTS if you are using Microsoft Windows NT) environment will be automatically enlisted in a global transaction where required. |
Load Balance Timeout | The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
PoolBlockingPeriod | Defines the blocking period behavior for a connection pool. |
Pooling | If true, the connection object is drawn from the appropriate pool, or created and added to the appropriate pool if necessary. |
Replication | |
Replication | If true, replication is supported using the connection. |
Security | |
Authentication | The authentication method for connecting to SQL Server. |
Column Encryption Setting | Enables or disables the Always Encrypted functionality for the connection. |
Enclave Attestation Url | The endpoint of an enclave attestation service that will be used to verify whether the enclave (configured in the SQL Server instance for computations on database columns encrypted using Always Encrypted) is valid and secure. |
Encrypt | If true, SQL Server will use SSL encryption for all data sent between the client and the server if the server has a certificate installed. |
Integrated Security | If true, the connection will be a secure connection. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
TrustServerCertificate | If true (and Encrypt is true), SQL Server uses SSL encryption for all data sent between the client and the server without validating the server certificate. |
Source | |
AttachDbFilename | The name of the primary file (including the full path) of an attachable database. |
Context Connection | If true, indicates that the connection should be from the SQL Server context. Available only when running in the SQL Server process. |
Failover Partner | The name or network address of the instance of SQL Server that acts as a failover partner. |
Initial Catalog | The name of the initial catalog or database in the data source. |
MultiSubnetFailover | If true and if your application is connecting to a high-availability, disaster recovery (AlwaysOn) availability group (AG) on different subnets, the MultiSubnetFailover property configures SqlConnection to provide faster detection of and connection to the currently active server. |
TransparentNetworkIPResolution | If true and if your application connects to different networks, the TransparentNetworkIPResolution property configures SqlConnection to provide transparent connection resolution to the currently active server, independently of the network IP topology. |
User Instance | If true, the connection will be re-directed to connect to an instance of SQL Server running under the user's account. |
Oracle provider connection strings
To establish a connection to an Oracle database using dotConnect Universal, you generally need to create a UniConnection object with a connection string. This string should contain basic properties like Provider, Direct, Server, Port, Sid, User Id, Password, and LicenseKey. Take a look at the example provided below.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=Oracle;" + "Direct=true;" + "Server=127.0.0.1;" + "Port=1521;" + "Sid=orcl;" + "User Id=TestUser;" + "Password=TestPassword;" "LicenseKey=**********"); ...
Basic connection string properties for Oracle | |
---|---|
Name | Description |
Provider | Oracle. |
Direct | If true, no Oracle client is used. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password for the Oracle login account. |
Port | The number of the port that the Oracle server is listening on. |
Server | The name or IP address of the TNS alias of the Oracle database to connect to. |
Service Name | The alias to an Oracle database instance (or many instances) to use in the Direct mode. The default value is an empty string. When Service Name is specified and implies several database instances, dotConnect Universal connects to the first instance provided by Oracle listener. Note that the Direct mode has limited support for RAC, it supports RAC with Connect Time Connection Failover (CTCF) only. |
Sid | The unique name for an Oracle database instance to use in the Direct mode. |
User Id | The Oracle login account. |
Moreover, dotConnect Universal offers a wide range of advanced connection string properties to customize Oracle connection behavior beyond the basic connection parameters. These properties allow you to make settings such as performance, optimization, security, monitoring and other advanced configurations described in the following table.
Advanced connection string properties for Oracle | |
---|---|
Name | Description |
Initialization | |
ClientId | The client identifier in the Oracle Global Application Context. |
Connect Mode | The administrative privileges to be used when opening a session. |
Connection Timeout | The amount of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. |
Default Command Timeout | The default timeout that command objects will use unless changed. |
Default Fetch Size | The default number of rows to transfer over the network at a time. |
Direct | If true, the Oracle client is not required for the connection. If false, the Oracle client is used. |
Enlist | If true, the data provider automatically attempts to enlist the connection in the current transaction context. |
Home | The Oracle home name. |
Lob Block Size | The size of a block (in megabytes) to read or write CLOB or NCLOB data from or to a database. This option is supported in OCI mode only. Applicable only for Unicode Oracle servers. The default value is 0, which means that the whole value is sent in one block. |
OraMts | If true, Oracle Services for Microsoft Transaction Server (OraMTS) is used for distributed transactions. |
Proxy Password | The password of the proxy user. |
Proxy User Id | The username of the proxy user. |
Statement Cache Purge | If true, the OCI statement cache is cleared when the connection goes back to the pool. |
Statement Cache Size | The size of the OCI statement cache. |
Transaction Scope Local | If true, an internal (non-distributed) transaction will be used to participate in a global transaction. |
Unicode | If true, OraDirect .NET will use UTF16 mode API calls. |
OCI Session Pooling | |
Connection Class | The connection class for Database Resident Connection Pooling. |
Oci Session Pool Allow Waiting | Determines the behavior of OCI session pool when all sessions are busy and the maximum number of sessions is reached. If true, a new connection will wait for an existing one to close. If false, an exception will be thrown. |
Oci Session Pool Connection Lifetime | The amount of time (in seconds) during which the session is kept alive in the OCI session pool. |
Oci Session Pool Increment | The number of sessions to create when all sessions are in use. |
OCI Session Pool Max Size | The maximum number of sessions allowed in the OCI session pool. |
OCI Session Pool Min Size | The minimum number of sessions allowed in the OCI session pool. |
OCI Session Pool Password | The proxy password. |
OCI Session Pool User Id | The proxy username. |
Oci Session Pooling | If true, the session is drawn from the OCI session pool. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the pool. |
Validate Connection | If true, connections received from the pool will be validated. |
Provider Behavior | |
Describe Stored Procedure | If true (the default value), enables optimization to improve stored procedure execution speed. |
HA Events | If true, enables dotConnect Universal to proactively remove connections to Oracle Real Application Clusters (RAC). |
Initialization Command | The database-specific command to be executed immediately after opening the connection. |
Number Mappings | Settings for mapping NUMBER and FLOAT data types to .NET types. The default value is an empty collection, which means the default mapping is used. |
Pass Parameters By Name | If true, parameters will be passed to the stored procedure calls by name regardless of individual OracleCommand.PassParametersByName values. |
Run Once Command | The command to be executed when the connection is opened the first time and not executed when the connection is taken from the pool. |
Trim Fixed Char | If true, trailing spaces are trimmed when reading data from fixed-length string data types (CHAR, NCHAR). |
Use Performance Monitor | If true, enables dotConnect Universal performance counters to measure the frequency of connections and disconnections to the data source. |
Security | |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
SSH | |
SSH Authentication Type | The client authentication method to be used: PublicKey, Password, or KeyboardInteractive. |
SSH Cipher List | The list of ciphers the client agrees to use. The following ciphers are available for SSH connections: 3DES, Blowfish, and AES(128). The default value is an empty string, which means that any cipher is allowed. |
SSH Host | The name or IP address of the SSH server. |
SSH Host Key | The location of the public key on the client side to verify the server host key during connection establishment. |
SSH Passphrase | The client key passphrase. |
SSH Password | The user's password on the SSH server. |
SSH Port | The number of the port on the SSH server to connect to. |
SSH Private Key | The location of the client private key. |
SSH Strict Host Key Checking | If true, the host key is verified during connection establishment. |
SSH User | The user ID on the SSH server. |
SSL | |
SSL Cert | The location of the client certificate. |
SSL Key | The location of the user’s private key. |
SSL ServerCertDN | The Distinguished Name (DN) for verifying the Oracle server's SSL certificate during connection. |
SSL WalletPath | The location of the Oracle Wallet used to retrieve a certificate for connecting to Oracle in Direct mode. |
Oracle Client provider connection strings
If you're connecting to Oracle Client using dotConnect Universal, your connection string typically includes basic properties like Provider, Data Source, User ID, Password, and LicenseKey, just like in the sample code that follows.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=OracleClient;" + "Data Source=127.0.0.1;" + "User ID=TestUser;" + "Password=TestPassword;" "LicenseKey=**********"); ...
Basic connection string properties for Oracle Client | |
---|---|
Name | Description |
Provider | OracleClient. |
Data Source | The name or IP address of the database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password to be used when connecting to the data source. |
User ID | The user ID to be used when connecting to the data source. |
Still, the Oracle Client connection string can be extended with advanced properties to account for initialization, pooling, or security settings. Refer to the following table for details.
Advanced connection string properties for Oracle Client | |
---|---|
Name | Description |
Initialization | |
Omit Oracle Connection Name | If true, omits calls to set the connection name attribute through Oracle's OCI. This is useful for Oracle databases that pre-date version 9i, as older versions do not support the OCI connection name attribute. The default value is false, which means the connection name attribute will be set. Setting this attribute is necessary for enlisting in a distributed transaction. |
Unicode | If true, the client supports the Unicode functionality available in Oracle. If false, the client is non-Unicode aware. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Enlist | If true, sessions in a Component Services (or MTS if you are using Microsoft Windows NT) environment will be automatically enlisted in a global transaction where required. |
Load Balance Timeout | The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection object is drawn from the appropriate pool, or created and added to the appropriate pool if necessary. |
Security | |
Integrated Security | If true, the connection will be a secure connection. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
MySQL provider connection strings
Basic properties of a connection string you would use to connect to a MySQL database using dotConnect Universal would include the Provider, Server, User ID, Password, Database, and LicenseKey properties. An example of a connection object is provided below.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=MySQL;" + "Server=127.0.0.1;" + "User Id=TestUser;" + "Password=TestPassword;" + "Database=TestDb" + "LicenseKey=**********"); ...
Basic connection string properties for MySQL | |
---|---|
Name | Description |
Provider | MySQL. |
Database | The name of the database to connect to. |
Host | The name or IP address of the host of the MySQL database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password for the MySQL login account. |
Server | The name or IP address of the server to connect to. |
User Id | The MySQL login account. |
Yet, the connection string can just as well accommodate for more sophisticated settings of MySQL connection, such as initialization, performance and optimization, security, and other advanced configurations. Select the needed properties from the list below.
Advanced connection string properties for MySQL | |
---|---|
Name | Description |
HTTP Options | |
HTTP Base64 | If true, data will be encoded in MIME base64 format before being sent with the POST request. |
HTTP Content Length | Obsolete. The HTTP Content Length property was used to specify the size of the message body (in bytes) for both client and server. |
HTTP Host | Obsolete, use HTTP script tunnelling and the HTTP Url property instead. The HTTP Host property was used to specify the name or IP address of the host of the HTTP tunnel server to connect to. |
HTTP Keep Alive | The timeout (in seconds) for sending Keep-Alive HTTP packets. The default value is 1 second. |
HTTP Max Connection Age | Obsolete. The HTTP Max Connection Age property was used to specify the maximum connection age (in seconds). The default value is 300 seconds. |
HTTP Password | The password for the restricted website where the tunnelling script resides. |
HTTP Port | Obsolete, use HTTP script tunnelling and the HTTP Url property instead. The HTTP Port property was used to specify the port of the HTTP tunnel server to connect to. |
HTTP Strict Content Length | Obsolete. The HTTP Strict Content Length property was used to enable data padding if the message size was smaller than ContentLength. The default value is true, which means that data padding is enabled. |
HTTP Url | The URL of the HTTP tunneling PHP script. For example, http://localhost/tunnel.php. |
HTTP User | The username for the restricted website where the tunnelling script resides. |
Initialization | |
Binary As Guid | If true, the provider will treat BINARY(16) columns as GUIDs. |
Binary Uuid Order | If true, the binary UUID order of bytes will be used when converting BINARY(16) to System.Guid or MySqlGuid. |
Char As Guid | If true, the provider will treat CHAR(36) columns as GUIDs. |
Character Set | The client encoding character set to which string data will be converted. |
Client Interactive | If true, the client will connect to the MySQL server as an interactive client. |
Compress | If true, enables data packet compression. |
Connection Timeout | The amount of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. |
Default Command Timeout | The default timeout that MySqlCommand objects will use unless changed. |
Default FetchAll | If true, the default value of the FetchAll property of MySqlCommand instances is used. When FetchAll mode is enabled, the MySqIDataReader object retrieves all queried data from the server on execution. |
Direct | If true, enables access to the MySQL server without a client library. |
Disable Charset Sending | If true, disables explicit charset resetting for the session taken from a pool. |
Embedded | If true, the embedded MySQL server will be used. |
Enlist | If true, the data provider automatically attempts to enlist the connection in the current transaction context. |
Found Rows | If true, the provider will return the number of rows matched by the WHERE condition of the UPDATE statement instead of the number of rows actually changed. |
Ignore Fractional Seconds | If true, disables fractional seconds support for TIME, DATETIME, and TIMESTAMP values. |
Ignore Prepare | If true, the provider ignores MySqlCommand.Prepare() calls. |
Keep Alive | The interval (in seconds) at which TCP keep-alive packets are sent. The default value is 0, which means that the packets are not sent. |
Ping Interval | The amount of time (in seconds) before pinging the MySQL server and reopening the connection if required. |
Pipe Name | The name of the pipe to use when connecting via named pipes. |
Protocol | The type of transport protocol to use. |
Server Parameters | Specifies the command-line argument for launching the MySQL embedded server. The SERVER Parameters property is typically used to provide the path of the files used by the server and the path of the folder where the data files reside. For example, \"--basedir=d:/servers/embedded/;--datadir=d:/servers/embedded/data/;\" |
Sql Modes | The SQL mode to be set for the current session. |
Tiny As Boolean | If true, the provider will treat TINYINT(1) columns as boolean. |
Transaction Scope Local | If true, an internal (non-distributed) transaction will be used to participate in a global transaction. |
Unicode | If true, sets the client charset to UTF8 and converts client data according to this charset. |
Validate Connection | If true, connections received from the pool will be validated. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the pool. |
Provider Behavior | |
Initialization Command | The database-specific command to be executed immediately after opening the connection. |
Run Once Command | The command to be executed when the connection is opened the first time and not executed when the connection is taken from the pool. |
Proxy Options | |
Proxy Host | The name or IP address of the proxy server to connect to. |
Proxy Password | The password for the proxy server account. |
Proxy Port | The port of the proxy server to connect to. |
Proxy User | The proxy server account. |
Security | |
Backslash Escapes Mode | Determines how backslashes are handled in SQL queries. If enabled, backslashes are treated as escape characters, allowing special characters to be included in strings. If disabled, backslashes are treated as regular characters. The Auto mode allows the system to determine the appropriate behavior based on the context. |
Default Auth Plugin | The name of the authentication plugin to use. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
Plugin Dir | The directory where the plugin is located. |
Source | |
Port | The port of MySQL database to which to connect. |
SSH | |
SSH Authentication Type | The client authentication method to be used. |
SSH Cipher List | The list of ciphers the client agrees to use. |
SSH Host | The name or IP address of the SSH server. |
SSH Host Key | The location of the public key on the client side to verify the server host key during connection establishment. |
SSH Passphrase | The client key passphrase. |
SSH Password | The user's password on the SSH server. |
SSH Port | The number of the port on the SSH server to connect to. |
SSH Private Key | The location of the client private key. |
SSH Strict Host Key Checking | If true, the host key is verified during connection establishment. |
SSH User | The user ID on the SSH server. |
SSL | |
SSL CA Cert | The location of the authority certificate. |
SSL Cert | The location of the client certificate. |
SSL Cipher List | The list of ciphers the client agrees to use. |
SSL Key | The location of the user's private key. |
SSL TLS Protocol | The preferred TLS protocol version reported to a server when establishing a secure connection. |
PostgreSQL provider connection strings
To connect to a PostgreSQL database using dotConnect Universal, you need to specify at least the basic properties, such as Provider, Host, Port, User Id, Password, Database, Initial Schema, and LicenseKey. Just like in the example below.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=PostgreSQL;" + "Host=127.0.0.1;" + "Port=5432;" + "User Id=TestUser;" + "Password=TestPassword" + "Database=TestDb" + "Initial Schema=Public" + "LicenseKey=**********"); ...
Basic connection string properties for PostgreSQL | |
---|---|
Name | Description |
Provider | PostgreSQL. |
Database | The name of the database to connect to. |
Host | The name or IP address of the host of the PostgreSQL server to connect to. |
Initial Schema | The name of the initial schema. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password for the PostgreSQL login account. |
Port | The port of the PostgreSQL server to connect to. |
Source | The name of the server to connect to. |
User Id | The PostgreSQL login account. |
If you would like to have more control over the PostgreSQL connection, then consider using advanced properties. The below list provides a comprehensive selection of properties to set up initialization, performance and optimization, security, and other connection parameters.
Advanced connection string properties for PostgreSQL | |
---|---|
Name | Description |
Behavior | |
AllowDateTimeOffset | If true, PgSqlDataReader returns a value of DateTimeOffset type when the GetValue method is called for fields with the timestamp with timezone data type in the corresponding columns. |
Enlist | If true, the data provider automatically attempts to enlist the connection in the current transaction context. |
Force IPv4 | If true, the IPv4 address must always be used for authentication. If false, authentication can be performed using an IPv6 address. |
Ignore Unnamed Parameters | If true, the '?' character in CommandText will not be treated as an unnamed parameter. |
Join Statement Notices | If true, all the notices raised during the statement execution will be returned together in one InfoMessage event after the statement execution. If false, each notice will be returned in a separate InfoMessage event. |
Keep Connected | The duration (in seconds) of connection inactivity before the client sends a ping request. The default value is 0, which means that the keepalive ping round trip is disabled. |
Target Session | Determines how the driver chooses the appropriate server session when multiple hosts are used. |
Transaction Error Behavior | Determines how the driver handles errors that occur within a transaction. |
Transaction Scope Local | If true, an internal (non-distributed) transaction will be used to participate in a global transaction. |
Unprepared Execute | If true, queries will be sent in simple query mode— when queries are executed without preparation on the server. |
Validate Connection | If true, connections received from the pool will be validated. |
Initialization | |
ApplicationName | The client application name. |
Character Set | The client encoding character set to which string data will be converted. |
Connection Timeout | The amount of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. |
Default Command Timeout | The default timeout that command objects will use unless changed. |
Default FetchAll | If true, the default value of the FetchAll property of MySqlCommand instances is used. When FetchAll mode is enabled, the MySqIDataReader object retrieves all queried data from the server on execution. |
Keep Alive | The interval (in seconds) at which TCP keep-alive packets are sent. The default value is 0, which means that the packets are not sent. |
Protocol | The Frontend/Backend Protocol version. Available values are 2 (for the protocol version 2.0) and 3 (for protocol version 3.0). |
Unicode | If true, sets the client charset to UTF8 and converts client data according to this charset. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the appropriate pool. |
Provider Behavior | |
Initialization Command | The database-specific command to be executed immediately after opening the connection. |
Run Once Command | The command to be executed when the connection is opened the first time and not executed when the connection is taken from the pool. |
Proxy Options | |
Proxy Host | The name or IP address of the proxy server to connect to. |
Proxy Password | The password for the proxy server account. |
Proxy Port | The port of the proxy server to which to connect. |
Proxy User | The proxy server account. |
Security | |
Integrated Security | If true, the current Windows account credentials will be used for SSPI authentication. If false, user ID and password need to be specified in the connection string. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
SSH | |
SSH Authentication Type | The client authentication method to be used. |
SSH Cipher List | The list of ciphers the client agrees to use. |
SSH Host | The name or IP address of the SSH server. |
SSH Host Key | The location of the public key on the client side to verify the server host key during connection establishment. |
SSH Passphrase | The client key passphrase. |
SSH Password | The user's password on the SSH server. |
SSH Port | The number of the port on the SSH server to connect to. |
SSH Private Key | The location of the client private key. |
SSH Strict Host Key Checking | If true, the host key is verified during connection establishment. |
SSH User | The user ID on the SSH server. |
SSL | |
SSL CA Cert | The location of the authority certificate. |
SSL Cert | The location of the client certificate. |
SSL Cipher List | The list of ciphers the client agrees to use. |
SSL Key | The location of the user’s private key. |
SSL TLS Protocol | The preferred TLS protocol version reported to a server when establishing a secure connection. |
SSLMode | The SSL connection priority. The default value is Disable, which means that only an unencrypted SSL connection will be attempted. |
SQLite provider connection strings
For a connection to a SQLite database using dotConnect Universal, you need a connection string with basic properties such as Provider, Data Source, FailIfMissing, and LicenseKey. The below sample code shows how the connection string is formed.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=SQLite;" + "Data Source=mydatabase.db;" + "FailIfMissing=False;" + "LicenseKey=**********"); ...
Basic connection string properties for SQLite | |
---|---|
Name | Description |
Provider | SQLite. |
Data Source | The database filename. |
FailIfMissing | Determines what to do when the database is not found. If true, an exception is thrown. If false, an empty database is created. |
LicenseKey | The activation key for dotConnect Universal. |
On top of this basic structure, you can add any of the advanced connection string properties for SQLite. Below you can find a whole set of properties that will let you configure your connection in terms of initialization, performance and optimization, security, and other advanced parameters.
Advanced connection string properties for SQLite | |
---|---|
Name | Description |
Initialization | |
Attach | The list of databases to attach, separated with semicolons. |
Automatic Index | If true, automatic indexing is enabled. |
AutoVacuum | The way the database size changes when data is deleted from it. |
Binary GUID | If true, GUIDs will be stored in binary format, saving space in the database. If false, GUIDs are stored as text. |
Busy Timeout | The amount of time (in milliseconds) the busy handler will sleep when a table is locked. The handler will sleep multiple times until at least the specified number of milliseconds of sleeping has accumulated. |
Cache Size | The maximum number of database disk pages that SQLite will hold in memory at once. |
Cache Spill | If true, enables the ability of the pager to spill dirty cache pages to the database file in the middle of a transaction. CacheSpill is enabled by default and most applications should leave it that way as cache spilling is usually advantageous. |
Case Sensitive Like | If true, comparisons using the LIKE operator will be case-sensitive. |
Cell Size Check | If true, database B-tree pages will undergo additional sanity checking as they are initially read from disk. |
Checkpoint FullFSync | If true, the F_FULLFSYNC syncing method will be used during checkpoint operations on systems that support F_FULLFSYNC. |
Connection Timeout | The amount of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error. |
Count Changes | If true, the database engine will return the number of inserted, updated, or deleted rows. |
DateTime Format | The datetime format. |
Default Command Timeout | The default timeout that command objects will use unless changed. |
Enable Load Extension | If true, the SQLite extension library specified in the Load Extension parameter will be loaded. |
Enlist | If true, the data provider automatically attempts to enlist the connection in the current transaction context. |
Foreign Key Constraints | Determines whether the foreign key constraint enforcement is on or off. If set to Default, default SQLite foreign key constraint enforcement settings will be used. |
Full Column Names | Determines the format of columns names for data returned by SELECT statements when the expression for the column is a table-column name or the "*" wildcard. If true, regardless of whether a join is performed, such columns will be named using the following format: <table-name/alias> <column-name>. |
Full FSync | If true, the F_FULLFSYNC syncing method will be used on systems that support it. |
Ignore Check Constraints | If true, CHECK constraints are not enforced. |
Journal Mode | The journal mode for databases associated with the current database connection. |
Journal Size Limit | The maximum size (in bytes) of the rollback-journal and WAL files left in the file system after transactions or checkpoints. Negative values mean no limit. |
Legacy File Format | If true, the legacy 3.xx format is used for maximum compatibility, but this results in larger database sizes. |
Load Extension | The list of SQLite extension libraries that will be loaded when the connection opens. This parameter is applied only when Enable Load Extension is set to true. |
Locking | The database locking mode. If Normal, the database connection unlocks the database file at the conclusion of each read or write transaction. If Exclusive, the database connection never releases file locks. |
Max Page Count | The maximum number of pages the database may hold. |
Page Size | The page size for the connection. |
Read Uncommitted | If true, the isolation level for connection is READ UNCOMMITTED. The default value is false, which means the isolation level is SERIALIZABLE. A database connection at the Read Uncommitted isolation level doesn't attempt to acquire a read lock on the table before reading from it. This can lead to inconsistent query results if another database connection modifies data in the table while it is being read, but it also means that a read transaction opened by a connection at the READ UNCOMMITTED isolation level can neither block nor be blocked by another connection. |
ReadOnly | If true, the database will be opened in read-only mode. If the database does not exist yet, an error will be thrown. This option is available only if the connection uses the UTF8 encoding. |
Recursive Triggers | If true, the recursive triggers will be turned on. |
Reverse Unordered Selects | If true, SELECT statements without an ORDER BY clause will return their results in the reverse order of what they normally would. |
Secure Delete | Determines if deleted data is securely erased. If set to On, the deleted data will be overwritten with zeroes. |
Short Column Names | Determines the format of column names for data returned by SELECT statements when the expression for the column is a table-column name or the "*" wildcard. If true, regardless of whether a join is performed, such columns will be named using the following format: <column-name>. |
Synchronous | The synchronization mode of write operations: Off, Normal, Full, or Extra. |
Temp Store | The location where temporary tables and indices are stored. |
Temp Store Directory | The directory where files used for storing temporary tables and indices are kept. |
Threads | The maximum number of auxiliary threads that a prepared statement is allowed to launch to assist with a query. |
Transaction Scope Local | If true, an internal (non-distributed) transaction will be used to participate in a global transaction. |
UTF16 | If true, the connection will use the UTF16 encoding. |
Validate Connection | If true, connections received from the pool will be validated. |
Version | The default version of the SQLite engine to instantiate. Currently, the only valid value is 3, indicating version 3 of the SQLite library. |
WAL Auto Checkpoint | The write-ahead log auto-checkpoint interval (the number of the write-ahead log pages after which the checkpoint is performed). |
Writable Schema | If true, the SQLITE_MASTER tables can be changed using ordinary UPDATE, INSERT, and DELETE statements. Note that editing SQLITE_MASTER table in such a way can result in a corrupt database file. |
Misc | |
SQLiteCryptLicenseKey | The software license key for the SQLiteCrypt extension. Necessary if connecting to an SQLiteCrypt encrypted database. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the appropriate pool. |
Provider Behavior | |
Initialization Command | The database-specific command to be executed immediately after opening the connection. |
Run Once Command | The command to be executed when the connection is opened the first time and not executed when the connection is taken from the pool. |
Security | |
Encryption | The encryption extension to use. Note that an encryption extension can be used only when SQLite engine supports it. |
Encryption License Key | The license key to be used with the SQLiteCrypt or SQLCipher extension. This parameter is used only if Encryption is set to SQLiteCrypt or SQLCipher. |
Password | The password for the database, encrypted with AES128, AES256, AES192, Blowfish, Cast128, RC4, TripleDES embeded algorithms or using SEE, CEROD, SQLCipher or SQLiteCrypt extension. The Password property can be used only when SQLite engine supports it. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
User Id | The user ID to be used when connecting to the datasource. |
MS Access provider connection strings
You can use dotConnect Universal to connect to MS Access and work with its data. To do this, you need a connection string with the following basic properties: Provider, Data Source, User ID, Password, Database, and LicenseKey. Refer to the sample code below to see how this can be done.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=MS Access;" + "Data Source=127.0.0.1;" + "User ID=TestUser;" + "Password=TestPassword;" + "Database=TestDb;" + "LicenseKey=**********"); ...
Basic connection string properties for MS Access | |
---|---|
Name | Description |
Provider | MS Access. |
Data Source | The name or IP address of the data source to connect to. |
Database | The name of the database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password for connecting to the data source. |
User ID | The user ID for connecting to the data source. |
To tweak your connection to MS Access, you have a whole bunch of advanced properties available. You can set up initialization, performance and optimization, security, and other parameters. Review the following list and select what suits your needs.
Advanced connection string properties for MS Access | |
---|---|
Name | Description |
Advanced | |
Compact Reclaimed Space Amount | The estimated amount of storage space (in bytes) that can be reclaimed by compacting the database. This value is applied only after a database connection is established. |
Compact Without Replica Repair | If true, damaged replicas will not be repaired. If false, attempts will be made to repair damaged replicas by searching for other databases to synchronize with. |
Create System Database | If true, a system database will be created when creating a new data source. |
Database Locking Mode | The locking mode for the database. The locking mode is determined by the first user to open the database and remains in effect while the database is open. |
Database Password | The database password. |
Don't Copy Locale on Compact | If true, Jet will not retain locale information when compacting the database. |
Encrypt Database | If true, the database will be encrypted during compaction. If false, the compacted database inherits the encryption status of the original database. |
Engine Type | The storage engine to be used to access the current data store. |
Extended Properties | Additional properties to enhance model objects. |
Global Bulk Transactions | Determines whether SQL bulk operations are managed within a transactional scope. Possible values are 1 (bulk transactions are not transacted) and 2 (bulk transactions are transacted). |
Global Partial Bulk Ops | Determines whether partial bulk operations are allowed. Possible values are 1 (partial completion of bulk operations is allowed) and 2 (partial completion of bulk operations is not allowed). |
Locale Identifier | The preferred locale ID allowing the server to identify and apply the consumer's Locale Identifier of choice when applicable. |
Mode | Access permissions using a bitmask. |
New Database Password | The new password to be set for the database instead of the one passed as the Database Password property. |
Registry Path | The Windows registry key that stores configuration values for the Jet database engine. |
System database | The path and file name of the workgroup information file (system database). |
Named ConnectionString | |
Named ConnectionString | The UDL file to use when connecting to the Data Source. |
Pooling | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
OLE DB Services | The value to be passed for the OLE DB Services key defining a combination of values that enable or disable OLE DB services. The default value is -13. For other values, refer to the OLE DB documentation. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the appropriate pool. |
Security | |
Cache Authentication | If true, the data source object or enumerator is allowed to cache sensitive authentication information such as a password in an internal cache. |
Encrypt Password | If true, the password will be encrypted. |
Mask Password | If true, the password—which is security-sensitive information—will not be returned as part of the connection details if the connection is open or has been opened previously. |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
OLE DB provider connection strings
Your basic connection string to establish a connection using the OLE DB provider and dotConnect Universal would include the Provider, Data Source, User Id, Password, Database, and LicenseKey properties. The following example showcases such a connection.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=OLE DB;" + "Data Source=127.0.0.1;" + "UserId=TestUser;" + "Password=TestPassword;" + "Database=TestDb;" + "LicenseKey=**********"); ...
Basic connection string properties for OLE DB | |
---|---|
Name | Description |
Provider | OLE DB. |
Data Source | The name or IP address of the data source to connect to. |
Database | The name of the database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password to be used when connecting to the data source. |
User Id | The user ID to be used when connecting to the data source. |
And if you want to optimize or refine the OLE DB connection, you can use any of the advanced properties you have at hand, for example security or pooling parameters. Below is the list of available advanced properties for a connection string.
Advanced connection string properties for OLE DB | |
---|---|
Name | Description |
Misc | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the pool. |
Named ConnectionString | |
File Name | The UDL file to use when connecting to the Data Source. |
Pooling | |
OLE DB Services | OLE DB Services to enable or disable with the OleDb Provider. |
Security | |
Persist Security Info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
Source | |
OLE DB Provider | The name of the OLE DB Provider to use when connecting to the Data Source. |
ODBC provider connection strings
A connection string with basic properties is generally enough to establish a connection using the ODBC provider and dotConnect Universal. Such properties are Provider, Data Source, User Id, Password, Database, and LicenseKey. Below is an example of their usage.
using Devart.Data.Universal; ... UniConnection connection = new UniConnection("" + "Provider=ODBC;" + "Data Source=127.0.0.1;" + "User Id=TestUser;" + "Password=TestPassword;" + "Database=TestDb;" + "LicenseKey=**********"); ...
Basic connection string properties for ODBC | |
---|---|
Name | Description |
Provider | ODBC. |
Data Source | The name or IP address of the data source to connect to. |
Database | The name of the database to connect to. |
LicenseKey | The activation key for dotConnect Universal. |
Password | The password to be used when connecting to the data source. |
User Id | The user ID to be used when connecting to the data source. |
However, you can have slightly more control over the ODBC connection with the use of advanced properties. The following table describes the available ones.
Advanced connection string properties for ODBC | |
---|---|
Name | Description |
Misc | |
Connection Lifetime | The amount of time (in seconds) during which the connection is kept alive. |
Max Pool Size | The maximum number of connections allowed in the pool. |
Min Pool Size | The minimum number of connections allowed in the pool. |
Persist security info | If false, security-sensitive information, such as the password, will not be returned as part of the connection if the connection is open or has ever been in an open state. |
Pooling | If true, the connection is drawn from the appropriate pool or is created and added to the pool. |
Named ConnectionString | |
Dsn | The DSN to use when connecting to the Data Source. |
Source | |
Driver | The name of the ODBC driver to use when connecting to the Data Source. |
Conclusion
dotConnect Universal connection strings are fundamental to enabling proper communication between .NET applications and database back-ends. This guide has demonstrated the capabilities of connection strings when you use dotConnect Universal that can ensure reliable and efficient database interactions.
With its flexibility and support for multiple database providers, dotConnect Universal simplifies complex integration tasks, empowering developers to build robust, high-performance applications. Explore the full potential of dotConnect Universal by downloading the free trial today and experience how it meets your database connectivity needs!