EnableConnectionStringAllowedProperties(FileInfo, bool)

This method accepts a file path to an allowed parameter list in a JSON file.

Declaration

// C#
public static void EnableConnectionStringAllowedProperties(FileInfo jsonFile, bool enforceOnAlias)

Parameters

  • jsonFile

    Specifies the JSON allowed parameters file path.

  • enforceOnAlias

    Whether to enforce the allowed parameters list on TNS aliases

Exceptions

OracleException – If Universal Naming Convention (UNC) file paths are not allowed and the file path is configured with a UNC file path.

OracleException – An OracleException (ORA-50124: Configuration file is required to be named as {0}) is thrown if the file path contains a file name other than ODPConnectionStringAllowedProperties.json.

InvalidOperationException – If this method is invoked with a different JSON file path than used earlier after at least one connection has been opened.

Remarks

The JSON file parameter of type FileInfo can be set to the directory that contains the ODPConnectionStringAllowedProperties.json file or to the full file path with that JSON file. If a file name is supplied, it must be ODPConnectionStringAllowedProperties.json.

ODP.NET will check the connection string Data Source if any disallowed parameters are included. If so, the request will not be allowed to connect.

If the application calls the EnableConnectionStringAllowedProperties method before the first connection is created, then ODP.NET tries to open and read the ODPConnectionStringAllowedProperties.json file. Failure to open or read the file throws an exception.

The application cannot invoke the EnableConnectionStringAllowedProperties method, which takes a different JSON file location after a valid connection has been opened. However, the application may invoke the method again with the same file path and a different enforceOnAlias value. The Boolean parameter will be applied as configured.

The application can update the JSON file contents during runtime. ODP.NET proactively tries to read the file once it is saved.