1.SQL SERVER 数据库的OLE DB
Provider=SQLOLEDB;Data Source=MyServer\MyInStance;Initial Catalog=MyDatabase;User ID=MyUID;Password=MyPassword;
网络凭据连接到SQL Server,可以利用集成安全性Integrated Security
Provider=SQLOLEDB;Data Source=MyServer;Initial Catalog=MyDatabase;Integrated Security=SSPI;
注:
较老的网络凭据
Provider=SQLOLEDB;Data Source=MyServer;Initial Catalog=MyDatabase;Trusted_Connection=Yes;
provider是代表数据库提供者是什么样的数据库!如SQL Server是SQLOLEDB.1, Oracle
Persist
Initial
2.Oracle 数据库的OLE DB
Provider=MYDBORA;Data Source=MyDatabaseAlias;User ID=MyUID;Password=MyPassword;
3.Access 数据库的OLE DB
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Path\To\MyDatabse.MDB;
如果没有指定数据库的完整路径,ADO就会在应用程序的当前路径中查找数据库。
相对路径Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Date\MyDatabse.MDB;
使用Jet安全性的Access数据库
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\...\MySecure.MDB;
Jet OLEDB:System database=C:\...\MyStem.MDW;
User ID=MyUserName;Password=MyPassword;
另外一个选项则连接到一个带有数据库密码的Access数据库
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\...\MySecure.MDB;
Jet OLEDB:Database Password=MyPassword;
//
Access 2007
This is a compiled connection strings reference list on how to connect to Access 2007.
ACE OLEDB 12.0
Standard security
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
With database password
This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;
===========================================================================
格式如下:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;