终于搞清楚了ADO数据库连接中的Persist Security Info参数的作用
ADO用了这么久,每次用向导创建ADO的数据库连接字符串时总会有产生一个Persist Security Info属性,平时没太注意,因为设置为True或False时对数据库连接没有任何影响。不过心理还是不爽,今天有时间查询了一下资料,总算搞清楚了它的作用。
Persist Security Info属性的意思是表示是否保存安全信息,其实可以简单的理解为"ADO在数据库连接成功后是否保存密码信息",
True表示保存,False表示不保存
ADO缺省为True
(ADO.net缺省为False,未测试,根据参考资料上说的)
具体可以通过ADO的Connect对象的ConnectString属性进行验证,如下所示(以下在Delphi7中测试通过):
----------------------------------------------------------------------------------------------------------
数据库连接前
ConnectString="Provider=MSDAORA.1;Password=mypassword;User ID=yzs;Data Source=ydgl22;Persist Security Info=false"
数据库连接成功后
ConnectString="Provider=MSDAORA.1;User ID=yzs;Data Source=ydgl22"
----------------------------------------------------------------------------------------------------------
数据库连接前
ConnectString="Provider=MSDAORA.1;Password=mypassword;User ID=yzs;Data Source=ydgl22;Persist Security Info=true"
数据库连接成功后
ConnectString="Provider=MSDAORA.1;Password=mypassword;User ID=dlyx;Data Source=ydgl22"
----------------------------------------------------------------------------------------------------------
总体来说,如果数据库连接成功后不再需要连接的密码,出于安全性考虑,还是建议将Persist Security Info设为false,以防止后门程序取得数据库连接的密码(windows2003在sp1前就发生过这个问题)。
以下是摘自微软的ADO.net资料
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsecureadonetconnections.asp
Keep Persist Security Info as False
Setting Persist Security Info to true or yes will allow security-sensitive information, including the userid and password, to be obtained from the connection after the connection has been opened. If you are supplying a userid and password when making a connection, you are most protected if that information is used to open the connection, and then discarded. As a result, your option that helps to provide greater security is to set Persist Security Info to false or no.
This is especially important if you are supplying an open connection to an untrusted source or persisting connection information to disk. Keeping Persist Security Info as false helps ensure that the untrusted source does not have access to the security-sensitive information for your connection and also helps ensure that no security-sensitive information is persisted to disk with your connection string information.
Persist Security Info is false by default.
分享到:
相关推荐
Print显示排版应用程序adocon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;...Persist Security Info=False" adocon.Open(VB6.0源代码编写) Print显示排版应用 QQ223857666勾月guocan@msn.cn
Persist Security Info=True;User ID=sa;Initial Catalog=DBName;Data Source=myserver'; ADOConnectionPool:=TADOConnectionPool.Create(PoolSize,5); //删除空闲5分钟的数据连接 ADOConnectionPool....
Set读入access数据库程序(VB6.0源代码编写)strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\text.mdb;Persist Security Info=False
保存到Access数据库,Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;...Persist Security Info=False" Adodc1.RecordSource = "select * from 汽车信息表" Adodc1.Refresh(VB6.0源代码编写)
.net数据库 .NET Framework 数据提供程序的核心对象创建打开连接 SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = “ConnectionString”; or: string myString = ...
2.根据书中数据库步骤,在SQL数据库中建立数据库,使用数据脚本生成数据库表 3.然后将BookShop.dat和BookShopOrders.dat数据库数据导入到数据库 4.如果数据库发生变化,请修改Web.config文件中的 ...
<add key="SQLConnString1" value="Persist Security Info=False;Data Source=127.0.0.1;Initial Catalog=BookShop;User ID=sa;Password=;" /> <add key="SQLConnString2" value="Persist Security Info=False;...
Persist Security Info=True;User ID=system;Password=Service01;"; OracleConnection con = new OracleConnection(connString); con.Open(); return string.Empty; } catch (Exception ex) { return ex....
/*采用mysql数据库中作为vc的连接数据库,当采用ado来处理时,只需要按下面步骤即可。 1.下载mysql odbc,or mysql ole,由于俺下了个mysql ole出了错,偷懒便直接下了mysql odbc, 版本必须是3.51.11以上的,...
Delphi2009连接火鸟Firebird数据库的示例源代码及操作Firebird数据库的中文参考资料.是嵌入版,不需要服务器,可以直接发布. 注意:发布的时候要带上dbxdrivers.ini和dbxconnections.ini两个配制文件, 这两个文件一般...
' + 'Persist Security Info=true;Jet OLEDB:Database Password=111'; end; ``` 使用 Delphi 连接加密的 Access 数据库需要进行多步设置和配置,包括设置 Access 数据库的密码和在 Delphi 中配置 ADOConnection ...
Persist Security Info=False" ConnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Test.accdb;Persist Security Info=False" End Sub Sub New(ByVal OleConnStr As ...
Persist Security Info=False;Jet OLEDB:Database Password=691126" ,"", "", adModeUnknown); // 打开数据库并建立连接(有密码) //conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;" ,"", ...
Persist Security Info=True; ===> 不用修改此项; User ID=sa; ===> 数据库用户名; Password=sa ===> 数据库用户名对应的密码。 --> ;Initial Catalog=Takeaway;Persist Security Info=True;User ID=sa;...
Persist Security Info=False; Password=Psd;Data Source=filename.mdb"。如果出现“无法启动应用程序,工作组信息文件丢失,或是已被其他用户已独占方式打开。”错误,可以检查连接字符串是否正确,并确保 Access ...
注意运行前需要将文件下的Data备份的数据库备份文件还原到SQL2000中,另外还需要修改MenuManager.cpp文件的数据库连接信息,如下: try { .... strSQL="Provider=SQLOLEDB.1;Persist Security Info=False; ...
Persist Security Info=True;User ID=sa;Password=123456" /> 修改其中的数据库配置文件到相应数据库 点击NavAPP.exe既可运行程序。 ORACLE 数据库使用说明 使用pl/sql developer或者oracle dump命令从data.dmp文件...
VB6.0 ADO添加数字文本信息,演示如何添加数字或字符型数据,从连接数据库、打开记录集、可添加数据到显示数据到表格中,演示了一系列的实现,是一个基础的VB与access操作的范例。这一切的执行,需要从点击一个按钮...
在运行系统之前,用户必须配置连接数据库的字符串,配置连接数据库的字符串存放在Web.config文件中,Web.config文件中的配置连接数据库的字符串如以下代码所示: ;Initial Catalog=voddb;Persist Security Info=...
在运行系统之前,用户必须配置连接数据库的字符串,配置连接数据库的字符串存放在Web.config文件中,Web.config文件中的配置连接数据库的字符串如以下代码所示: <connectionStrings> <add name=...