在web.config中asp.net连接Oracle数据库 [英] oracle database connection in web.config asp.net
本文介绍了在web.config中asp.net连接Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我可以创建在C#类本身就是一个连接字符串,但我尽量避免这样做。我想创建在web.config中,我读的是更安全的连接。不过我找不到有指定下列属性的例子:
I know I can create a connection string in the c# class itself, but I am trying to avoid doing that. I want to create the connection in the web.config, which I read is more secure. Nevertheless I couldn't find any example that has the following attributes specified:
- 主机名
- 端口
- SID
- 用户名
- 密码
- 连接名称
谁能帮助在webconfig创建这个讨好?我连接到Oracle数据库。
Could anyone help please with creating this in webconfig? I am connecting to oracle DB.
推荐答案
下面是模板:
<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>
下面是我的一个 - 减去一个真正的TNS名称,用户名和密码:
Here is one of mine - minus a real TNS name and username and password:
<add name="MSOL" connectionString="Data Source={TNS_NAME};User ID={username};Password={password};pooling=true;min pool size=5;Max Pool Size=60" providerName="Oracle.DataAccess.Client"/>
这篇关于在web.config中asp.net连接Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文