OracleConnectionStringBuilder Class
Generates automatically connection strings used to connect to Oracle.
This sample shows how to construct a connection string and pass it to
OracleConnection object.
public void UseConnectionStringBuilder()
{
OracleConnectionStringBuilder myCSB = new OracleConnectionStringBuilder();
oraCSB.Direct = true;
oraCSB.Server = "192.168.0.1";
oraCSB.Port = 1521;
oraCSB.Sid = "OracleSid";
oraCSB.UserId = "scott";
oraCSB.Password = "tiger";
oraCSB.MaxPoolSize = 150;
oraCSB.ConnectionTimeout = 30;
OracleConnection myConnection = new OracleConnection(myCSB.ConnectionString);
myConnection.Open();
Console.WriteLine(myConnection.ServerVersion);
myConnection.Close();
}
Public Sub UseConnectionStringBuilder()
Dim myCSB As OracleConnectionStringBuilder = New OracleConnectionStringBuilder
oraCSB.Direct = true
oraCSB.Server = "192.168.0.1"
oraCSB.Port = 1521
oraCSB.Sid = "OracleSid"
oraCSB.UserId = "scott"
oraCSB.Password = "tiger"
oraCSB.MaxPoolSize = 150
oraCSB.ConnectionTimeout = 30
Dim myConnection As OracleConnection = New OracleConnection(myCSB.ConnectionString)
myConnection.Open()
Console.WriteLine(myConnection.ServerVersion)
myConnection.Close()
End Sub
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