[英]How to specify Oracle SID to connectionStrings in web.config?
I have an ASP.NET application whose connection to the database seems to fail to open because of the Oracle SID not being specified. 我有一个ASP.NET应用程序,由于未指定Oracle SID,与数据库的连接似乎无法打开。 I can't find any doc on how to specify it in the connection string. 我在连接字符串中找不到有关如何指定它的任何文档。 Did anyone have the same problem? 有人遇到过同样的问题吗?
Here is the sample : 这是示例:
<connectionStrings>
<add name="{ConnectionName}"
connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;"
providerName="Oracle.DataAccess.Client"/>
</connectionStrings>
After adding the connection string to the web config you can use 将连接字符串添加到Web配置后,您可以使用
System.Configuration.ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;
To retrieve the connection string 检索连接字符串
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.