Credential

This property is used to get or set an OracleCredential object on the connection.

Declaration

// C#
public OracleCredential Credential { get; set; }

Property Value

An OracleCredential object to be used for opening connection.

Exceptions

An InvalidOperationException will be raised in following scenarios:

  • If connection is already open.

  • If connection string has already been set on this connection and it contains any of user id, password, DBA Privilege, proxy user id or proxy password.

  • The AccessToken property is set.

  • The TokenLocation properties is set. This is aplicable for managed ODP.NET and ODP.NET Core only.

  • TokenAuthentication is set to something other than disabled. This is aplicable for managed ODP.NET and ODP.NET Core only.

Remarks

To obtain the OracleCredential object through the property getter, "persist security info" must be set to true in the connection string.

If "Persist security info" is set to false in the Connection String, then the OracleCredential object is not returned through the property getter after the password has been validated.