7.
ODBC DSN
這應該是最簡單的!
"DSN=MyDSN;Uid=MyUsername;Pwd=MyPassword;"
若是有使用 OLE DB 的話
OLE DB Provider for SQL Server
"Provider=sqloledb;Data Source=MyServerName;Initial Catalog=MyDatabaseName;User Id=MyUsername;Password=MyPassword;"
信任連線:
"Provider=sqloledb;Data Source=MyServerName;Initial Catalog=MyDatabaseName;Integrated Security=SSPI;"
不同的 Named instance:
"Provider=sqloledb;Data Source=MyServerName\MyInstanceName;Initial Catalog=MyDatabaseName;User Id=MyUsername;Password=MyPassword;"
本機連線
"Provider=sqloledb;Data Source=(local);Initial Catalog=myDatabaseName;User ID=myUsername;Password=myPassword;"
遠端主機
"Provider=sqloledb;Network Library=DBMSSOCN;Data Source=130.120.110.001,1433;Initial Catalog=MyDatabaseName;User ID=MyUsername;Password=MyPassword;"
OLE DB Provider for MySQL
"Provider=MySQLProv;Data Source=test"
OLE DB Provider for AS400
"Provider=IBMDA400;Data source=myAS400;User Id=myUsername;Password=myPassword;
OLE DB Provider for Active Directory
"Provider=ADSDSOObject;User Id=myUsername;Password=myPassword;"
OLE DB Provider for DB2
"Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=130.120.110.001;Initial Catalog=MyCatalog;Package Collection=MyPackageCollection;Default Schema=MySchema;User ID=MyUsername;Password=MyPassword;"
使用 APPC 連線:
"Provider=DB2OLEDB;APPC Local LU Alias=MyLocalLUAlias;APPC Remote LU Alias=MyRemoteLUAlias;Initial Catalog=MyCatalog;Package Collection=MyPackageCollection;Default Schema=MySchema;User ID=MyUsername;Password=MyPassword;"
OLE DB Provider for Microsoft Jet - Access
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DatabasePath\MmDatabase.mdb;User Id=admin;Password=;"
如果使用 Workgroup:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataBasePath\mydb.mdb;Jet OLEDB:System Database=MySystem.mdw;"
OLE DB Provider for Microsoft Jet - Excel
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\DatabasePath\\DBSpreadSheet.xls;Extended Properties="Excel 8.0;HDR=Yes;"
OLE DB Provider for Microsoft Jet - Text File
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DatabasePath\;Extended Properties="text";HDR=Yes;FMT=Delimited;
OLE DB Provider for Microsoft Jet - Outlook
"Provider=Microsoft.Jet.OLEDB.4.0;Outlook 9.0;MAPILEVEL=;DATABASE=C:\Temp\;"
OLE DB Provider for Microsoft Jet - Exchange
"Provider=Microsoft.Jet.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Mailbox - Pat Smith|;DATABASE=C:\Temp\;"
OLE DB Provider for ODBC Databases - Access
"Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\DatabasePath\MyDatabase.mdb;Uid=MyUsername;Pwd=MyPassword;"
OLE DB Provider for ODBC Databases - SQL Server
"Provider=MSDASQL;Driver={SQL Server};Server=MyServerName;Database=MyDatabaseName;Uid=MyUsername;Pwd=MyPassword;"
使用 DSN:
"Provider=MSDASQL;PersistSecurityInfo=False;Trusted_Connection=Yes;Data Source=MyDSN;catalog=MyDatabase;"
OLE DB Provider for OLAP
"Provider=MSOLAP;Data Source=MyOLAPServerName;Initial Catalog=MyOLAPDatabaseName;"
使用 HTTP 連線:
"Provider=MSOLAP;Data Source=http://MyOLAPServerName/;Initial Catalog=MyOLAPDatabaseName;"
SSL:
"Provider=MSOLAP;Data Source=https://MyOLAPServerName/;Initial Catalog=MyOLAPDatabaseName;"
OLE DB Provider for Oracle (Micorsoft)
"Provider=MSDAORA;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"
OLE DB Provider for Oracle (Oracle)
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"
信任連線:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=/;Password=;"
以 OSAuthent 認證:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
OLE DB Provider for Visual FoxPro
"Provider=vfpoledb;Data Source=C:\DatabasePath\MyDatabase.dbc;"