Oracle.ManagedDataAccess.Client 与代理用户有错误 ORA-01017:无效 username/password;登录被拒绝

Oracle.ManagedDataAccess.Client with Proxy User has error ORA-01017: invalid username/password; logon denied

我有一个项目通过 ODAC 连接(很好)到 Oracle,Oracle.DataAccess.Client 在 .NET 中。我想将其切换为使用 Oracle.ManagedDataAccess.Client,但它给出了一个错误 ORA-01017: invalid username/password; logon denied。我知道当我 connect/login 作为“代理用户”时会发生错误,因为当我从我的连接字符串中删除代理用户信息时它有效(没有错误),但是我不能使用表,SP,我需要的包。

作为开发人员,我需要使用“代理用户”登录以模拟多个不同的后端作业,因为我t/won无法获取这些帐户的密码。 (proxy/impersonate) 技术与非托管 DataAccess 配合得很好(支持起来很麻烦)但我无法让它与 ManagedDataAccess.

配合使用

这是我的代码:

  static void Main(string[] args)
  { // I need to impersonate the [reportbot] account to use that schema
    string constr = "User Id=developer2[reportbot];Password=Wysiwyg.12345;Data Source=ProdJobDb;";
    string ProviderName = "Oracle.ManagedDataAccess.Client";

    DbProviderFactory factory = DbProviderFactories.GetFactory(ProviderName);

    using (DbConnection conn = factory.CreateConnection())
    {
      try
      {
        conn.ConnectionString = constr;
        conn.Open();
        //run SPs that [ReportBot] has access to, but dev contractor accounts don't
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message); //breakpoint here F9
        Console.WriteLine(ex.StackTrace);
      }
    }
  }

link建议以下连接字符串

// Connecting using proxy authentication

con.ConnectionString = "User Id=scott;Password=tiger;" + 
  "Data Source=oracle;Proxy User Id=appserver;Proxy Password=eagle; ";

根据您的输入是

 real user     reportbot  (you have no password)
 proxy user    developer2 (you have password)

所以要使用的连接字符串是

 "User Id=reportbot;Proxy User Id=developer2;Proxy Password=<your delevoper pwd>;Data Source=ProdJobDb;";