Connecting to Oracle using Oracle.ManagedDataAccess

前端 未结 4 1629
时光说笑
时光说笑 2021-01-04 01:43

I am using Oracle.ManagedDataAccess Nuget Package Version 12.1.022 in my C# (.NET 4.0) project. The package automatically creates entries in the app.config file. How can I r

4条回答
  •  时光取名叫无心
    2021-01-04 02:13

    Typically, you would refer to the alias in a standard connection string:

      
        
      
    

    Then you would use the standard method for retrieving the string:

    ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
    

    Also keep in mind that the alias in the data source section is optional. You can embed the descriptor directly in the connection string:

      
        
      
    

    You can also refer to aliases in a tnsnames.ora file. By default the driver looks for a tnsnames.ora in the exe folder, a directory specified in a TNS_ADMIN environment variable, or the TNS_ADMIN config variable:

    http://docs.oracle.com/cd/E48297_01/doc/win.121/e41125/featConfig.htm#autoId6 http://docs.oracle.com/cd/E48297_01/doc/win.121/e41125/featConfig.htm#autoId7

提交回复
热议问题