




已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
QQ:403223630 社区ID:happy2 禁止外传 ADO.NET连接字符串说明1 - SQL Server2 - SQL Server 20053 - ACCESS, Oracle4 - MySQL, Interbase, IBM DB25 - Sybase, Informix, Ingres, Mimer SQL, Lightbase, PostgreSQL, Paradox, DNS6 - Firebird, Excel , Text, DBF / FoxPro, AS/400 (iSeries), Exchange, Visual FoxPro, Pervasive, UDL1 SQL ServerODBC标准安全 Driver=SQL Server; Server=Aron1; Database=pubs; Uid=sa; Pwd=asdasd; 信任的连接 Driver=SQL Server; Server=Aron1; Database=pubs; Trusted_Connection=yes; 提示输入用户名和密码oConn.Properties( Prompt ) = adPromptAlwaysoConn.Open Driver=SQL Server; Server=Aron1; DataBase=pubs; OLE DB, OleDbConnection (.NET) 标准安全 Provider=sqloledb; Data Source=Aron1; Initial Catalog=pubs; User Id=sa; Password=asdasd; 信任的连接 Provider=sqloledb; Data Source=Aron1; Initial Catalog=pubs; Integrated Security=SSPI; (use serverNameinstanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)提示输入用户名和密码oConn.Provider = sqloledb oConn.Properties( Prompt ) = adPromptAlwaysoConn.Open Data Source=Aron1; Initial Catalog=pubs; IP地址连接管道 Provider=sqloledb; Data Source=00,1433; Network Library=DBMSSOCN; Initial Catalog=pubs; User ID=sa; Password=asdasd; (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)SqlConnection (.NET)标准安全 Data Source=Aron1; Initial Catalog=pubs; User Id=sa; Password=asdasd; - or - Server=Aron1; Database=pubs; User ID=sa; Password=asdasd; Trusted_Connection=False (both connection strings produces the same result) 信任的连接 Data Source=Aron1; Initial Catalog=pubs; Integrated Security=SSPI; - or - Server=Aron1; Database=pubs; Trusted_Connection=True; (both connection strings produces the same result) (use serverNameinstanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000) IP地址连接管道 Data Source=00,1433; Network Library=DBMSSOCN; Initial Catalog=pubs; User ID=sa; Password=asdasd; (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)定义SqlConnection对象C#:using System.Data.SqlClient; SqlConnection oSQLConn = new SqlConnection(); oSQLConn.ConnectionString= my connection string ; oSQLConn.Open(); VB.NET:Imports System.Data.SqlClientDim oSQLConn As SqlConnection = New SqlConnection()oSQLConn.ConnectionString= my connection string oSQLConn.Open() Data ShapeMS Data Shape Provider=MSDataShape; Data Provider=SQLOLEDB; Data Source=Aron1; Initial Catalog=pubs; User ID=sa; Password=asdasd; 2 SQL Server 2005SQL Native Client ODBC Driver标准安全 Driver=SQL Native Client; Server=Aron1; Database=pubs; UID=sa; PWD=asdasd; 信任的连接 Driver=SQL Native Client; Server=Aron1; Database=pubs; Trusted_Connection=yes; EquivalentsIntegrated Security=SSPI equals Trusted_Connection=yes提示输入用户名和密码oConn.Properties( Prompt ) = adPromptAlwaysoConn.Open Driver=SQL Native Client; Server=Aron1; DataBase=pubs; 授权的MARS(多重活动结果集) Driver=SQL Native Client; Server=Aron1; Database=pubs; Trusted_Connection=yes; MARS_Connection=yes EquivalentsMultipleActiveResultSets=true equals MARS_Connection=yes加密数据网络传输 Driver=SQL Native Client; Server=Aron1; Database=pubs; Trusted_Connection=yes; Encrypt=yes 在本地SQL服务器实例附加数据库文件 Driver=SQL Native Client; Server=.SQLExpress; AttachDbFilename=c:asdqwemydbfile.mdf; Database=dbname; Trusted_Connection=Yes; - or - Driver=SQL Native Client; Server=.SQLExpress; AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname; Trusted_Connection=Yes; (use |DataDirectory| when your database file resides in the data directory)SQL Native Client OLE DB Provider 标准安全 Provider=SQLNCLI; Server=Aron1; Database=pubs; UID=sa; PWD=asdasd; 信任的连接 Provider=SQLNCLI; Server=Aron1; Database=pubs; Trusted_Connection=yes; EquivalentsIntegrated Security=SSPI equals Trusted_Connection=yes提示输入用户名和密码oConn.Properties( Prompt ) = adPromptAlwaysoConn.Open Provider=SQLNCLI; Server=Aron1; DataBase=pubs; 授权的MARS(多重活动结果集) Provider=SQLNCLI; Server=Aron1; Database=pubs; Trusted_Connection=yes; MarsConn=yes EquivalentsMarsConn=yes equals MultipleActiveResultSets=true equals MARS_Connection=yes加密数据网络传输 Provider=SQLNCLI; Server=Aron1; Database=pubs; Trusted_Connection=yes; Encrypt=yes 在本地SQL服务器实例附加数据库文件 Provider=SQLNCLI; Server=.SQLExpress; AttachDbFilename=c:asdqwemydbfile.mdf; Database=dbname; Trusted_Connection=Yes; - or - Provider=SQLNCLI; Server=.SQLExpress; AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname; Trusted_Connection=Yes; (use |DataDirectory| when your database file resides in the data directory)SqlConnection (.NET) 标准安全 Data Source=Aron1; Initial Catalog=pubs; User Id=sa; Password=asdasd; - or - Server=Aron1; Database=pubs; User ID=sa; Password=asdasd; Trusted_Connection=False (both connection strings produces the same result)信任的连接 Data Source=Aron1; Initial Catalog=pubs; Integrated Security=SSPI; - or - Server=Aron1; Database=pubs; Trusted_Connection=True; (both connection strings produces the same result)IP地址连接管道 Data Source=00,1433; Network Library=DBMSSOCN; Initial Catalog=pubs; User ID=sa; Password=asdasd; (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default)授权的MARS(多重活动结果集) Server=Aron1; Database=pubs; Trusted_Connection=True; MultipleActiveResultSets=true Note! Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1在本地SQL服务器实例附加数据库文件 Server=.SQLExpress; AttachDbFilename=c:asdqwemydbfile.mdf; Database=dbname; Database=dbname; Trusted_Connection=Yes; - or - Server=.SQLExpress; AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname; Trusted_Connection=Yes; Using User Instance on a local SQL Server Express instance Data Source=.SQLExpress; integrated security=true; attachdbfilename=|DataDirectory|mydb.mdf; user instance=true; The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer. To enable the functionality: sp_configure user instances enabled,1 (0 to disable)Using SQL Server 2005 Express? Dont miss the server name syntax: SERVERNAMESQLEXPRESS (Substitute SERVERNAME with the name of the computer)Context Connection - connecting to self from within your CLR stored prodedure/functionContext Connection - connecting to self from within your CLR stored prodedure/function C# using(SqlConnection connection = new SqlConnection(context connection=true)connection.Open(); / Use the connection Visual BasicUsing connection as new SqlConnection(context connection=true)connection.Open() Use the connectionEnd UsingRead more When to use SQL Native Client? .Net applicationsDo not use the SQL Native Client. Use the .NET Framework Data Provider for SQL Server (SqlConnection). COM applications, all other then .Net applications COM applications, all other then .Net applicationsUse the SQL Native Client if you are accessing an SQL Server 2005 and need the new features of SQL Server 2005 such as MARS, encryption, XML data type etc. Continue use your current provider (OLE DB / ODBC through the MDAC package) if you are not connecting to an SQL Server 2005 (thats quite obvious eh.) or if you are connecting to an SQL Server 2005 but are not using any of the new SQL Server 2005 features. 3 ACCESSODBC标准安全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=OLE DB, OleDbConnection (.NET) 标准安全Provider=Microsoft.Jet.OLEDB.4.0; Data Source=somepathmydb.mdb; User Id=admin; Password=; 工作组 (system database)Provider=Microsoft.Jet.OLEDB.4.0; Data Source=somepathmydb.mdb; Jet OLEDB:System Database=system.mdw; 使用密码Provider=Microsoft.Jet.OLEDB.4.0; Data Source=somepathmydb.mdb; Jet OLEDB:Database Password=MyDbPassword; OracleODBC新版本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; OLE DB, OleDbConnection (.NET) 标准安全Provider=msdaora; Data Source=MyOracleDB; User Id=UserName; Password=asdasd; This ones from Microsoft, the following are from Oracle 标准安全Provider=OraOLEDB.Oracle; Data Source=MyOracleDB; User Id=Username; Password=asdasd; 信任的连接Provider=OraOLEDB.Oracle; Data Source=MyOracleDB; OSAuthent=1; OracleConnection (.NET) 标准Data Source=MyOracleDB; Integrated Security=yes; This one works only with Oracle 8i release 3 or later指定用户名和密码Data Source=MyOracleDB; User Id=username; Password=passwd; Integrated Security=no; This one works only with Oracle 8i release 3 or later定义OracleConnection对象C#:using System.Data.OracleClient; OracleConnection oOracleConn = new OracleConnection(); oOracleConn.ConnectionString = my connection string; oOracleConn.Open();VB.NET:Imports System.Data.OracleClientDim oOracleConn As OracleConnection = New OracleConnection()oOracleConn.ConnectionString = my connection stringoOracleConn.Open()Core Labs OraDirect (.NET) 标准User ID=scott; Password=tiger; Host=ora; Pooling=true; Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0Data Shape 微软数据模型Provider=MSDataShape.1; Persist Security Info=False; Data Provider=MSDAORA; Data Source=orac; user id=username; password=mypw4 MySQLMyODBCMyODBC 2.50 本地数据库Driver=mySQL; Server=localhost; Option=16834; Database=mydatabase; MyODBC 2.50 远程数据库:Driver=mySQL; Server=; Port=3306; Option=131072; Stmt=; Database=my-database; Uid=username; Pwd=password; MyODBC 3.51 本地数据库DRIVER=MySQL ODBC 3.51 Driver; SERVER=localhost; DATABASE=myDatabase; USER=myUsername; PASSWORD=myPassword; OPTION=3; MyODBC 3.51 远程数据库DRIVER=MySQL ODBC 3.51 Driver; SERVER=; PORT=3306; DATABASE=myDatabase; USER=myUsername; PASSWORD=myPassword; OPTION=3; OLE DB, OleDbConnection (.NET) 标准Provider=MySQLProv; Data Source=mydb; User Id=UserName; Password=asdasd; Connector/Net 1.0 (.NET)标准Server=Server; Database=Test; Uid=UserName; Pwd=asdasd; Download the driver at MySQL Developer Zone指定端口Server=Server; Port=1234; Database=Test; Uid=UserName; Pwd=asdasd; Default port is 3306. Enter value -1 to use a named pipe connection.定义mysqlclient 连接对象C#:using MySql.Data.MySqlClient; MySqlConnection oMySqlConn = new MySqlConnection(); oMySqlConn.ConnectionString = Server=Server; Database=Test; Uid=UserName; Pwd=asdasd; ; oMySqlConn.Open();VB.NET:Imports MySql.Data.MySqlClientDim oMySqlConn As MySqlConnection = New MySqlConnection()oMySqlConn.ConnectionString = Server=Server; Database=Test; Uid=UserName; Pwd=asdasd; oMySqlConn.Open() MySqlConnection (.NET)eInfoDesigns.dbProviderData Source=server; Database=mydb; User ID=username; Password=pwd; Command Logging=false This one is used with eInfoDesigns dbProvider, an add-on to .NET定义MySqlConnection连接对象C#:using eInfoDesigns.dbProvider.MySqlClient; MySqlConnection oMySqlConn = new MySqlConnection(); oMySqlConn.ConnectionString = my connection string; oMySqlConn.Open();VB.NET:Imports eInfoDesigns.dbProvider.MySqlClientDim oMySqlConn As MySqlConnection = New MySqlConnection()oMySqlConn.ConnectionString = my connection stringoMySqlConn.Open()SevenObjects MySqlClient (.NET)标准Host=server; UserName=myusername; Password=mypassword; Database=mydb; This is a freeware ADO.Net data provider from SevenObjectsCore Labs MySQLDirect (.NET)标准User ID=root; Password=pwd; Host=localhost; Port=3306; Database=test; Direct=true; Protocol=TCP; Compress=false; Pooling=true; Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0 InterbaseODBC, Easysoft 本地计算机Driver=Easysoft IB6 ODBC; Server=localhost; Database=localhost:C:mydatabase.gdb; Uid=username; Pwd=password远程计算机Driver=Easysoft IB6 ODBC; Server=ComputerName; Database=ComputerName:C:mydatabase.gdb; Uid=username; Pwd=password ODBC, Intersolv 本地计算机Driver=INTERSOLV InterBase ODBC Driver (*.gdb); Server=localhost; Database=localhost:C:mydatabase.gdb; Uid=username; Pwd=password远程计算机Driver=INTERSOLV InterBase ODBC Driver (*.gdb); Server=ComputerName; Database=ComputerName:C:mydatabase.gdb; Uid=username; Pwd=password OLE DB, SIBPROvider标准provider=sibprovider; location=localhost:; data source=c:databasesgdbsmygdb.gdb; user id=SYSDBA; password=masterkey指定字符集provider=sibprovider; location=localhost:; data source=c:databasesgdbsmygdb.gdb; user id=SYSDBA; password=masterkey; character set=ISO8859_1指定规则provider=sibprovider; location=localhost:; data source=c:databasesgdbsmygdb.gdb; user id=SYSDBA; password=masterkey; role=DIGITADORESIBM DB2OLE DB, OleDbConnection (.NET) from msTCP/IPProvider=DB2OLEDB; Network Transport Library=TCPIP; Network Address=XXX.XXX.XXX.XXX; Initial Catalog=MyCtlg; Package Collection=MyPkgCol; Default Schema=Schema; User ID=MyUser; Password=MyPWAPPCProvider=DB2OLEDB; APPC Local LU Alias=MyAlias; APPC Remote LU Alias=MyRemote; Initial Catalog=MyCtlg; Package Collection=MyPkgCol; Default Schema=Schema; User ID=MyUser; Password=MyPWIBMs OLE DB Provider (shipped with IBM DB2 UDB v7 or above)TCP/IPProvider=IBMDADB2; Database=sample; HOSTNAME=db2host; PROTOCOL=TCPIP; PORT=50000; uid=myUserName; pwd=myPwd;ODBC标准driver=IBM DB2 ODBC DRIVER; Database=myDbName; hostname=myServerName; port=myPortNum; protocol=TCPIP; uid=myUserName; pwd=myPwd5 SybaseODBC标准 Sybase System 12 (or 12.5) Enterprise Open ClientDriver=SYBASE ASE ODBC Driver; Srvr=Aron1; Uid=username; Pwd=password标准 Sybase System 11Driver=SYBASE SYSTEM 11; Srvr=Aron1; Uid=username; Pwd=password; Database=mydbIntersolv 3.10Driver=INTERSOLV 3.10 32-BIT Sybase; Srvr=Aron1; Uid=username; Pwd=password;Sybase SQL Anywhere (former Watcom SQL ODBC driver)ODBC; Driver=Sybase SQL Anywhere 5.0; DefaultDir=c:dbfolder; Dbf=c:mydatabase.db; Uid=username; Pwd=password; Dsn=OLE DBAdaptive Server Anywhere (ASA)Provider=ASAProv; Data source=myASAAdaptive Server Enterprise (ASE) with Data Source .IDS fileProvider=Sybase ASE OLE DB Provider; Data source=myASEAdaptive Server Enterprise (ASE)Provider=Sybase.ASEOLEDBProvider; Srvr=myASEserver,5000; Catalog=myDBname; User Id=username; Password=password- some reports on problem using the above one, try the following as an alternative - Provider=Sybase.ASEOLEDBProvider; Server Name=myASEserver,5000; Initial Catalog=myDBname; User Id=username; Password=password This one works only from Open Client 12.5 where the server port number feature works,following fully qualified connection strings to be used without definingfony .IDS Data Source files. AseConnection (.NET) 标准Data Source=myASEserver; Port=5000; Database=myDBname; UID=username; PWD=password; 定义AseConnection连接对象C#:using Sybase.Data.AseClient; AseConnection oCon = new AseConnection(); oCon.ConnectionString=my connection string; oCon.Open(); VB.NET:Imports System.Data.AseClientDim oCon As AseConnection = New AseConnection()oCon.ConnectionString=my connection stringoCon.Open() InformixODBCInformix 3.30Dsn=; Driver=INFORMIX 3.30 32 BIT; Host=hostname; Server=myserver; Service=service-name; Protocol=olsoctcp; Database=mydb; UID=username; PWD=myPwdInformix-CLI 2.5Driver=Informix-CLI 2.5 (32 Bit); Server=myserver; Database=mydb; Uid=username; Pwd=myPwdOLE DBIBM Informix OLE DB ProviderProvider=Ifxoledbc.2; password=myPw; User ID=myUser; Data Source=dbNameserverName; Persist Security Info=trueIngresODBCDSN-lessProvider=MSDASQL.1; DRIVER=Ingres; SRVR=xxxxx; DB=xxxxx; Persist Security Info=False; uid=xxxx; pwd=xxxxx; SELECTLOOPS=N; Extended Properties=SERVER=xxxxx; DATABASE=xxxxx; SERVERTYPE=INGRESMimer SQLODBC标准安全Driver=MIMER; Database=mydb; Uid=myuser; Pwd=mypw; 提示输入用户名和密码Driver=MIMER; Database=mydb;Lightbase标准标准user=USERLOGIN; password=PASSWORD; UDB=USERBASE; server=SERVERNAMEPostgreSQLCore Labs PostgreSQLDirect (.NET)标准User ID=root; Password=pwd; Host=localhost; Port=5432; Database=testdb; Pooling=true; Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0PostgreSQL driver标准DRIVER=PostgreSQL; SERVER=ipaddress; port=5432; DATABASE=dbname; UID=username; PWD=password; Npgsql by pgFoundry (.NET)SSL activatedServer=; Port=5432; Userid=myuserid; password=mypw; Protocol=3; SSL=true; Pooling=true; MinPoolSize=3; MaxPoolSize=20; Encoding=UNICODE; Timeout=20; SslMode=RequireWithout SSLServer=; Port=5432; Userid=myuserid; password=mypw; Protocol=3; SSL=false; Pooling=true; MinPoolSize=1; MaxPoolSize=20; Encoding=UNICODE; Timeout=15; SslMode=DisableParadoxODBC5.XDriver=Microsoft Paradox Driver (*.db ); DriverID=538; Fil=Paradox 5.X; DefaultDir=c:pathToDb; Dbq=c:pathToDb; CollatingSequence=ASCII7.XProvider=MSDASQL.1; Persist Security
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年冰箱节能行业研究报告及未来行业发展趋势预测
- 成品矿运送工特殊工艺考核试卷及答案
- 油乳制备工特殊工艺考核试卷及答案
- 气烧立窑石灰煅烧工作业指导书
- 黑龙江市二手房买卖及过户服务合同
- 公共卫生事件预警信息处理与防控服务合同
- 高校事业编制教师选聘与教育信息化建设合同
- Unit 4《Lesson2 Who is he 》(教学设计)-2024-2025学年闽教版(2024)英语三年级上册
- 全球夫妻离婚协议范本:跨国婚姻终止合同书
- 改性合成树脂装置操作工作业指导书
- 苏教版九年级数学上册全册教案
- 幼儿园教材教学培训
- 2025年高校教师资格证考试题库(带答案能力提升)
- 金属结构自检自查报告
- 2025年高端酒店装修设计与施工合同范本2篇
- 个人健康个性化营养搭配与服务提供系统建设
- 房地产估价四假设开发法的应用案例
- 2023年政府采购评审专家考试题库(含答案)
- GB/T 45083-2024再生资源分拣中心建设和管理规范
- 大型运输车辆交通安全教育
- 《国有资产管理》课件
评论
0/150
提交评论