Share via


OracleConnectionStringBuilder.IntegratedSecurity 속성

정의

"User ID"와 "Password"가 연결에 지정되어 있는지(false인 경우) 아니면 현재 Windows 계정 자격 증명이 인증에 사용되는지(true인 경우)를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool IntegratedSecurity { bool get(); void set(bool value); };
public bool IntegratedSecurity { get; set; }
member this.IntegratedSecurity : bool with get, set
Public Property IntegratedSecurity As Boolean

속성 값

IntegratedSecurity 속성의 값이거나, 제공된 값이 없으면 false입니다.

예제

다음 예제에서는 기존 연결 문자열을 Windows 인증 사용에서 통합 보안 사용으로 변환합니다. 이 예제에서는 연결 문자열에서 사용자 이름과 암호를 제거한 다음 IntegratedSecurity 개체의 OracleConnectionStringBuilder 속성을 설정하여 이 작업을 수행합니다.

참고

이 예제에는 OracleConnectionStringBuilder가 연결 문자열로 작업하는 방법을 보여 주기 위한 암호가 포함되어 있습니다. 애플리케이션에서는 Windows 인증을 사용하는 것이 좋습니다. 암호를 사용해야 하는 경우에는 애플리케이션에 하드 코드된 암호를 포함하지 마십시오.

// You may need to set a reference to the System.Data.OracleClient
// assembly before you can run this sample.
using System.Data.OracleClient;

class Program
{
    static void Main()
    {
        try
        {
            string connectString =
                "Data Source=OracleSample;User ID=Mary;Password=*****;";

            OracleConnectionStringBuilder builder =
                new OracleConnectionStringBuilder(connectString);
            Console.WriteLine("Original: " + builder.ConnectionString);

            // Use the Remove method
            // in order to reset the user ID and password back to their
            // default (empty string) values. Simply setting the
            // associated property values to an empty string will not
            // remove them from the connection string; you must
            // call the Remove method.
            builder.Remove("User ID");
            builder.Remove("Password");

            // Turn on integrated security.
            builder.IntegratedSecurity = true;

            Console.WriteLine("Modified: " + builder.ConnectionString);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

        Console.WriteLine("Press any key to finish.");
        Console.ReadLine();
    }
}
' You may need to set a reference to the System.Data.OracleClient
' assembly before you can run this example. 
Imports System.Data.OracleClient

Module Module1

  Sub Main()
    Try
      Dim connectString As String = _
       "Data Source=OracleSample;User ID=Mary;Password=*****;"

      Dim builder As New OracleConnectionStringBuilder(connectString)
      Console.WriteLine("Original: " & builder.ConnectionString)

      ' Use the Remove method
      ' in order to reset the user ID and password back to their
      ' default (empty string) values. Simply setting the 
      ' associated property values to an empty string will not
      ' remove them from the connection string; you must
      ' call the Remove method.
      builder.Remove("User ID")
      builder.Remove("Password")

      ' Turn on integrated security.
      builder.IntegratedSecurity = True

      Console.WriteLine("Modified: " & builder.ConnectionString)

    Catch ex As Exception
      Console.WriteLine(ex.Message)
    End Try

    Console.WriteLine("Press any key to finish.")
    Console.ReadLine()
  End Sub
End Module

설명

이 속성은 연결 문자열 내의 "Integrated Security" 키에 해당 합니다.

적용 대상

추가 정보