具体请参考 http://www.connectionstrings.com/
数据库链接大全:
这里只摘取SqlServer、Oracle、MySql、Access、Excel、SqlLite 等常用数据库的链接。
一、SqlServer:
1)NET libraries
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;Password=myPassword;
2)OLE DB providers
Provider=SQLNCLI11;Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Provider=SQLNCLI11;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Provider=SQLNCLI11;Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=yes;
3)ODBC drivers
Driver={SQL Server Native Client 11.0};Server=myServerAddress;
Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Driver={SQL Server Native Client 11.0};Server=myServerAddress;
Database=myDataBase;Trusted_Connection=yes;
Driver={SQL Server Native Client 11.0};Server=myServerName\theInstanceName;
Database=myDataBase;Trusted_Connection=yes;
二、Oracle
Data Source=MyOracleDB;Integrated Security=yes;
Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));
uid=myUsername;pwd=myPassword;
三、MySql
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;
Pwd=myPassword;
Server=serverAddress1, serverAddress2, serverAddress3;Database=myDataBase;
Uid=myUsername;Pwd=myPassword;
四、Access
1)Microsoft Access ODBC Driver
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;
SystemDB=C:\mydatabase.mdw;
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;
Uid=admin;Pwd=;
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;
ExtendedAnsiSQL=1;
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;
Locale Identifier=2057;Uid=Admin;Pwd=;
2)Microsoft Access accdb ODBC Driver
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;
Uid=Admin;Pwd=;
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;
SystemDB=C:\mydatabase.mdw;
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;
Exclusive=1;Uid=admin;Pwd=;
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;
Uid=Admin;Pwd=;ExtendedAnsiSQL=1;
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;
Locale Identifier=2057;Uid=Admin;Pwd=;
Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.mdb;
3)Microsoft Jet OLE DB 4.0
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;
Password=;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;
Jet OLEDB:Database Password=MyDbPassword;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;
Jet OLEDB:System Database=system.mdw;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;
Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\myDatabase.mdb;
User Id=admin;Password=;
Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=\\serverName\shareName\folder\myDatabase.mdb;User Id=admin;
Password=;
Provider=MS Remote;Remote Provider=Microsoft.Jet.OLEDB.4.0;
Remote Server=http://server.adress.com;Data Source=d:\myPath\myDatabase.mdf;
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;
Mode=Share Exclusive;User Id=admin;Password=;
4)Microsoft ACE OLEDB 12.0
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
Persist Security Info=False;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
Jet OLEDB:Database Password=MyDbPassword;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\myAccessFile.accdb;
Persist Security Info=False;
Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\server\share\folder\myAccessFile.accdb;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.mdb;
Persist Security Info=False;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.mdb;
Jet OLEDB:Database Password=MyDbPassword;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\myAccessFile.mdb;
Persist Security Info=False;
Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=\\serverName\shareName\folder\myAccessFile.mdb;
四、Excel
1)Microsoft Excel 2007 ODBC Driver
Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
DBQ=C:\MyExcel.xls;
2)Microsoft Excel ODBC Driver
Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;
DefaultDir=c:\mypath;
Driver={Microsoft Excel Driver (*.xls)};Dbq=C:\MyExcel.xls;ReadOnly=0;
3).NET Framework Data Provider for ODBC
Driver={any odbc driver's name};OdbcKey1=someValue;OdbcKey2=someValue;
4)CData ADO.NET Provider for Excel
Excel File=C:\myExcelFile.xlsx;
Excel File=C:\myExcelFile.xlsx;Header=False;
Excel File=C:\myExcelFile.xlsx;Cache Location=C:\cache.db;Auto Cache=true;
Offline=false;
Excel File=C:\myExcelFile.xlsx;Cache Location=C:\cache.db;Auto Cache=true;
Offline=false;Cache Metadata=true;
Excel File=C:\myExcelFile.xlsx;Offline=true;Query Passthrough=true;
Cache Location=C:\cache.db;
Cache Provider=Provider.Namespace;
Cache Connection='Connection String to Cache Database';
Excel File=C:\myExcelFile.xlsx;Empty Text Mode=EmptyAsNull;
Excel File=C:\myExcelFile.xlsx;Empty Text Mode=NullAsEmpty;
Excel File=C:\myExcelFile.xlsx;Ignore Calc Error=true;
Excel File=C:\myExcelFile.xlsx;Orientation=Horizontal;
Excel File=C:\myExcelFile.xlsx;Allow Formula=false;
5)Microsoft ACE OLEDB 12.0
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=1";
Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=c:\myFolder\myBinaryExcel2007file.xlsb;
Extended Properties="Excel 12.0;HDR=YES";
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsm;
Extended Properties="Excel 12.0 Macro;HDR=YES";
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls;
Extended Properties="Excel 8.0;HDR=YES";
五、SQLite
1)SQLite.NET
Data Source=c:\mydb.db;Version=3;
Data Source=:memory:;Version=3;New=True;
Data Source=c:\mydb.db;Version=3;UseUTF16Encoding=True;
Data Source=c:\mydb.db;Version=3;Password=myPassword;
Data Source=c:\mydb.db;Version=3;Legacy Format=True;
Data Source=c:\mydb.db;Version=3;Pooling=True;Max Pool Size=100;
Data Source=c:\mydb.db;Version=3;Read Only=True;
Data Source=c:\mydb.db;Version=3;DateTimeFormat=Ticks;
Data Source=c:\mydb.db;Version=3;BinaryGUID=False;
Data Source=c:\mydb.db;Version=3;Cache Size=2000;
Data Source=c:\mydb.db;Version=3;Page Size=1024;
Data Source=c:\mydb.db;Version=3;Enlist=N;
Data Source=c:\mydb.db;Version=3;FailIfMissing=True;
Data Source=c:\mydb.db;Version=3;Max Page Count=5000;
Data Source=c:\mydb.db;Version=3;Journal Mode=Off;
Data Source=c:\mydb.db;Version=3;Journal Mode=Persist;
Data Source=c:\mydb.db;Version=3;Synchronous=Full;
2)SQLite3 ODBC Driver
DRIVER=SQLite3 ODBC Driver;Database=c:\mydb.db;LongNames=0;Timeout=1000;NoTXN=0;
SyncPragma=NORMAL;StepAPI=0;