ASP.NET数据库连接串总结
jopen
10年前
1.SQL Server (1)ODBC "Driver={SQL Server};Server=Chris;Database=pubs;Uid=sa;Pwd=sa" "Driver={SQL Server};Server=Chris;Database=pubs;Trusted_Connection=yes;" oConn.Properties("Prompt") = adPromptAlways oConn.Open "Driver={SQL Server};Server=Chris;DataBase=pubs;" (2)OLEDB,OLEDBConnection(.net) "Provider=sqloledb;Data Source=Chris;Initial Catalog=pubs;User Id=sa;Password=sa;" "Provider=sqloledb;Data Source=Chris;Initial Catalog=pubs;Integrated Security=SSPI;" (use serverName/instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000) oConn.Provider = "sqloledb" oConn.Properties("Prompt") = adPromptAlways oConn.Open "Data Source=Chris;Initial Catalog=pubs;" "Provider=sqloledb;Data Source=192.168.0.1,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=sa;" (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)) (3) SqlConnection (.NET): "Data Source=Chris;Initial Catalog=pubs;User Id=sa;Password=sa;" "Data Source=Chris;Initial Catalog=pubs;Integrated Security=SSPI;" (use serverName/instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000) "Data Source=192.168.0.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=sa;" (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)) 2.Access (1)ODBC "Driver={Microsoft Access Driver (*.mdb)};Dbq=/somepath/mydb.mdb;Uid=Admin;Pwd=asdasd;" "Driver={Microsoft Access Driver (*.mdb)};Dbq=/somepath/mydb.mdb;SystemDB=/somepath/mydb.mdw;","admin", "" (2)OLEDB, OleDbConnection (.NET) "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/somepath/mydb.mdb;User Id=admin;Password=asdasd;" "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/somepath/mydb.mdb;Jet OLEDB:System Database=system.mdw;","admin", "" "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/somepath/mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;","admin", "" 3.Oracle (1)ODBC "Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;" "Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;" (2)OLEDB, OleDbConnection (.NET) "Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;" "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;" "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;" (3)OracleConnection (.NET) "Data Source=Oracle8i;Integrated Security=yes"; 4.MySql (1)ODBC "Driver={mySQL};Server=mySrvName;Option=16834;Database=mydatabase;" "Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;" (2)OLEDB, OleDbConnection (.NET) "Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd;" (3)MySqlConnection (.NET) "Data Source=server;Database=mydb;User ID=username;Password=pwd;Command Logging=false" 5.IBM DB2 (1)OLEDB, OleDbConnection (.NET) from ms "Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=MyUser;Password=MyPW" "Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=MyUser;Password=MyPW" 6.SyBase (1)ODBC "Driver={SYBASE SYSTEM 11};Srvr=Aron1;Uid=username;Pwd=password;" "Driver={INTERSOLV 3.10 32-BIT Sybase};Srvr=Aron1;Uid=username;Pwd=password;" 7. Informix (1)ODBC Driver={INFORMIX 3.30 32 BIT};Host=hostname;Server=myserver;Service=service-name;Protocol=olsoctcp;Database=mydb;UID=username;PWD=myPwd "Driver={Informix-CLI 2.5 (32 Bit)};Server=myserver;Database=mydb;Uid=username;Pwd=myPwd" 8.DSN (1)ODBC "DSN=myDsn;Uid=username;Pwd=;" "FILEDSN=c:/myData.dsn;Uid=username;Pwd=;" 9.Excel (1)ODBC "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:/MyExcel.xls;DefaultDir=c:/mypath;" (2)OLE DB "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/MyExcel.xls;Extended Properties=Excel 8.0;HDR=Yes;" "HDR=Yes;"