dotConnect for Oracle Documentation
Devart.Common Namespace / DbConnectionStringBuilder Class
Members Example

In This Topic
    DbConnectionStringBuilder Class
    In This Topic
    Generates automatically connection strings used to connect to a data source.
    The DbConnectionStringBuilder class provides the base class from which the strongly typed connection string builders (Devart.Data.Oracle.OracleConnectionStringBuilder) are derived. The connection string builders let developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings. The DbConnectionStringBuilder has been defined in a data source-agnostic manner. Because of the addition of the Devart.Common namespace, developers require a base class against which they can program in order to build connection strings that can work against an arbitrary database. But it is possible using this class to create invalid connection strings. It is recommended to use the strongly typed connection string builders (Devart.Data.Oracle.OracleConnectionStringBuilder and so on) because they support only key/value pairs that are supported by particular data source; trying to add invalid pairs will throw an exception. For more information, refer to the description of the System.Data.Common.DbConnectionStringBuilder class in MSDN.
    Devart.Common.DbConnectionStringBuilder csb = new Devart.Common.DbConnectionStringBuilder();
    csb["Direct"] = true;
    csb["Server"] = "";
    csb["Port"] = 1521;
    csb["Sid"] = "OracleSid";
    csb["User Id"] = "scott";
    csb["Password"] = "tiger";
    csb["Max Pool Size"] = 150;
    csb["Connection Timeout"] = 30;
    Devart.Data.Oracle.OracleConnection myConnection = new Devart.Data.Oracle.OracleConnection(csb.ConnectionString);
    Dim csb As Devart.Common.DbConnectionStringBuilder = New Devart.Common.DbConnectionStringBuilder
    csb("Direct") = true
    csb("Server") = ""
    csb("Port") = 1521
    csb("Sid") = "OracleSid"
    csb("User Id") = "scott"
    csb("Password") = "tiger"
    csb("Max Pool Size") = 150
    csb("Connection Timeout") = 30
    Dim myConnection As Devart.Data.Oracle.OracleConnection = New Devart.Data.Oracle.OracleConnection(csb.ConnectionString)
    Inheritance Hierarchy



    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also