Add(string, OracleOpaqueString)

This method adds a role with a password to the roles list and sets it on a on a newly created connection or a connection coming from connection pool.

Declaration

// C#
public void Add(string Role,  OracleOpaqueString Password);

Parameters

  • Role - Role name that will be set on a connection.

  • Password - Password of Role

Exceptions

ArgumentNullException - It is thrown when role name is provided as Null.

ArgumentException - It is thrown when role name is provided as empty string.

ArgumentException - It is thrown when case sensitive role name is not enclosed properly within double quotes.

InvalidOperationException - It is thrown when the connection is already open.

Remarks

The user must already be granted the database roles before adding those roles to the OracleRoleCollection object. Otherwise, an error occurs indicating the role is not granted or does not exist. The database roles not added to the ODP.NET collection are disabled for the session, except when no roles are added to the collection. In this case, the non-password-based roles are enabled in the database session.

To modify an existing connection's enabled roles, close the connection, modify the OracleRoleCollection instance associated with the connection instance, and reopen the connection.