热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

.NET中各种数据库连接大全(转)

.NET中各种数据库连接大全(转)[more].NET中各种数据库连接大全sql.gif)SQLSERVEROdbCStandardSecurity:driver{SQLSe
.NET中各种数据库连接大全 (转)[@more@]

.NET中各种数据库连接大全

sql.gif)"> SQL SERVER  Access
  •  ODBC

    •  Standard Security:
      "Driver={microsoft Access Driver (*.mdb)};Dbq=somepathmydb.mdb;Uid=Admin;Pwd=asdasd;"

    •  Workgroup:
      "Driver={Microsoft Access Driver (*.mdb)};Dbq=somepathmydb.mdb;SystemDB=somepathmydb.mdw;","admin", ""

  •  OLEDB, OleDbConnection (.NET)

    •  Standard security:
      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=somepathmydb.mdb;User Id=admin;Password=asdasd;"

    •  Workgroup (system database):
      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=somepathmydb.mdb;Jet OLEDB:System Database=system.mdw;","admin", ""

    •  With password:
      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=somepathmydb.mdb;Jet OLEDB:Database Password=MyDbPassword;","admin", ""

ORACLE.gif)"> Oracle
  •  ODBC

    •  New version:
      "Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;"

    •  Old version:
      "Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;"

  •  OLEDB, OleDbConnection (.NET)

    •  Standard security:
      "Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;"
      This one's from Microsoft, the following are from Oracle
    •  Standard Security:
      "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"

    •  Trusted Connection:
      "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"

  •  OracleConnection (.NET)

    •  Standard:
      "Data Source=oracle8i;Integrated Security=yes";
      This one works only with Oracle 8i release 3 or later
    •  Declare the OracleConnection:
      C#:
      using System.Data.OracleClient;
      OracleConnection oOracleConn = new OracleConnection();
      oOracleConn.ConnectionString = "my connectionstring";
      oOracleConn.Open();

      VB.NET:
      Imports System.Data.OracleClient
      Dim oOracleConn As OracleConnection = New OracleConnection()
      oOracleConn.ConnectionString = "my connectionstring"
      oOracleConn.Open()

  •  Data Shape

    •  MS Data Shape:
      "Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;user id=username;password=mypw"

MYSQL.gif)"> MySQL
  •  ODBC

    •  Local database:
      "Driver={mySQL};Server=mySrvName;Option=16834;Database=mydatabase;"

    •  Remote database:
      "Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;"

  •  OLEDB, OleDbConnection (.NET)

    •  Standard:
      "Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd;"
  •  MySqlConnection (.NET)

    •  EID:
      "Data Source=server;Database=mydb;User ID=username;Password=pwd;Command Logging=false"
      This one is used with eInfoDesigns dbProvider, an add-on to .net
    •  Declare the MySqlConnection:
      C#:
      using EID.MySqlClient;
      MySqlConnection oMySqlConn = new MySqlConnection();
      oMySqlConn.ConnectionString = "my connectionstring";
      oMySqlConn.Open();

      VB.NET:
      Imports EID.MySqlClient
      Dim oMySqlConn As MySqlConnection = New MySqlConnection()
      oMySqlConn.ConnectionString = "my connectionstring"
      oMySqlConn.Open()

DB2.gif)"> IBM DB2
  •  OLEDB, OleDbConnection (.NET) from ms

    •  TCP/IP:
      "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"

    •  APPC:
      "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"

Sybase.gif)"> Sybase
  •  ODBC

    •  Standard:
      "Driver={SYBASE SYSTEM 11};Srvr=Aron1;Uid=username;Pwd=password;"

    •  Intersolv 3.10:
      "Driver={INTERSOLV 3.10 32-BIT Sybase};Srvr=Aron1;Uid=username;Pwd=password;"

Informix.gif)"> Informix
  •  ODBC

    •  Informix 3.30:
      "Dsn='';Driver={INFORMIX 3.30 32 BIT};Host=hostname;Server=myserver;Service=service-name;Protocol=olsoctcp;Database=mydb;UID=username;PWD=myPwd

    •  Informix-CLI 2.5:
      "Driver={Informix-CLI 2.5 (32 Bit)};Server=myserver;Database=mydb;Uid=username;Pwd=myPwd"

 DSN
  •  ODBC

    •  DSN:
      "DSN=myDsn;Uid=username;Pwd=;"

    •  File DSN:
      "FILEDSN=c:myData.dsn;Uid=username;Pwd=;"

excel.gif)"> Excel
  •  ODBC

    •  Standard:
      "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:MyExcel.xls;DefaultDir=c:mypath;"

  •  OLE DB

    •  Standard:
      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:MyExcel.xls;Extended Properties=Excel 8.0;HDR=Yes;"
      "HDR=Yes;" indicates that the first row contains columnnames, not data
 DBF / FoxPro
  •  ODBC

    •  standard:
      "Driver={Microsoft dbaSE Driver (*.dbf)};DriverID=277;Dbq=c:mydbpath;"

  •  OLEDB, OleDbConnection (.NET)

    •  standard:
      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:folder;Extended Properties=dBASE IV;User ID=Admin;Password="

 Pervasive
  •  ODBC

    •  Standard:
      "Driver={Pervasive ODBC Client Interface};ServerName=srvname;dbq=@dbname"

 UDL
  •  UDL

    •  UDL:
      "File Name=c:myDataLink.udl;"

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-993484/,如需转载,请注明出处,否则将追究法律责任。

转:http://blog.itpub.net/10752043/viewspace-993484/



推荐阅读
author-avatar
高高G0623
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有