ConnectionString
PropertyThe Virtuoso ADO.NET Provider ConnectionString
property implements the IDbConnection.ConnectionString
property to get or set the string used to open a Virtuoso database connection, and includes the source database name and other parameters needed to establish the initial connection.
The default value is an empty string.
ConnectionString
has the following syntax.
Each connection string is a sequence of settings Individual settings are separated by semicolons.
Each setting is a pair of name and value delimited by the equal sign.
Whitespace is ignored on either side of both names and values.
Names are case insensitive.
The value part can be quoted by either single or double quote characters or remain unquoted at all.
However if it includes a semicolon, single quote, or double quote characters, it must be enclosed in either type of quotes.
To embed the same character that is used for enclosing the value the character within the value must be doubled.The following table lists the valid names for values within the ConnectionString
.
Name | Default | Description |
---|---|---|
Connect Timeout orConnection Timeout | 15 | The number of seconds to wait for a connection to the server before terminating the attempt and generating an error. |
Connection Lifetime | 0 | When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server and a server just brought on-line. |
Charset | utf-16 | Specifies the character set to be used by the provider when passing string values to and from the database. Must be set to utf-8 to handle Unicode strings passed in SPARQL/SPASQL queries of RDF data. |
Data Source orServer orAddress orNetwork Address orHost | The name or network address of the instance of Virtuoso server to which to connect. Can take comma delimited list of instances for connection fail over. | |
Encrypt | false | Specifies if the connection must be SSL encrypted. Currently encryption only works with an ODBC-based provider. |
Enlist | true | When true, the pooler automatically enlists the connection in the creation thread's current transaction context. |
Initial Catalog orDatabase | The name of the database. | |
Max Pool Size | 100 | The maximum number of connections allowed in the pool. |
Min Pool Size | 0 | The minimum number of connections allowed in the pool. |
Password orPwd | The password for the Virtuoso account logging on. | |
Persist Security Info | false | When set to 'false', security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open State. Resetting the connection string resets all connection string values including the password. |
Pooling | true | When true, the VirtuosoConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool. |
RoundRobin | false | Enables load balancing in which case the server for the connection is chosen at random from the comma delimited provided as for a Failover connection. |
User ID orUid | The Virtuoso login name. |
The ConnectionString
is similar to an OLE DB connection string, but is not identical.
Unlike OLE DB or ADO, the connection string that is returned is the same as the user set ConnectionString
minus security information if the Persist Security Info
value is set to false
(default).
The Virtuoso ADO.NET Data Provider neither persists nor returns the password in a connection string unless you set Persist Security Info
to true
.
The ConnectionString
property can be set only when the connection is closed.
Many of the connection string values have corresponding read-only properties.
When the connection string is set, all of these properties are updated, except when an error is detected; in this case, none of the properties are updated.
VirtuosoConnection
properties return only those settings contained in the ConnectionString
.
Resetting the ConnectionString
on a closed connection resets all connection string values (and related properties) including the password.
For example, if you set a connection string that includes "Database=Demo
", and then reset the connection string to "Data Source=myserver;User ID=dba;Password=dba
", the Database property is no longer set to Demo
.
The connection string is parsed immediately after being set.
If errors in syntax are found when parsing, a runtime exception (e.g., ArgumentException
) is generated.
Other errors can be found only when an attempt is made to open the connection.
CategoryDocumentation CategoryVirtuoso CategoryDotNET CategoryEntityFrameworks CategoryWebSite