Connection Strings 討論串:十一的部落:Xuite日誌
  • yan.kee
  • 文章分類
  • 最愛連結
  • 我的發燒文
  • 累積 | 今日
    loading......
  • 參觀人氣統計
  • BLOG玩意兒
  • 搜尋文章
  • 關鍵字
  • 最新文章
  • 最新回應
  • Re:只能在執行 Render() 的過程中調用 RegisterForEventValidation,by(11)於2008-07-03
    Re:[轉]自動清除7天以上的檔案 ,by(haoming)於2008-06-13
    Re:[kuso]尿布舞,by(11)於2008-05-18
    Re:[kuso]尿布舞,by(seth)於2008-05-18
    Re:C#中產生GUID,by(yankee)於2008-02-17
    Re:C#中產生GUID,by(jimmy)於2008-02-16
    Re:開發excel 問題討論串,by(11)於2008-02-02
    Re:Connection Strings 討論串,by(11)於2008-01-27
    Re:SQL 分頁,by(11)於2008-01-25
    Re:開發excel 問題討論串,by(11)於2008-01-16
  • 活動
  • 到台灣玩不帶走一張發票
    ===訪客來自===
    Locations of visitors to this page
  • 日誌使用資源






  • 如何使用RSS
    Powered by Xuite
    2008-01-08 12:05 Connection Strings 討論串
  • ?
  • .net文章
  • 好文轉寄
  • 平均分數:0 顆星    投票人數:0
    我要評分:
    標籤 : 


     Connection Strings  相關都會集中在此

    目前有ODBC 跟 OLE DB

    =================以下是ODBC====================
    FOR
    {
    dBASE
    Excel
    Text
    FoxPro
    Access
    SQL
    Oracle
    MYSQL
    AS400
    SyBase
    }
    DSN Connection
    ODBC DSN
    strConnect = _T("DSN=MyDSN;Uid=MyUsername;Pwd=MyPassword;");


    ===================開始===================

    ODBC Driver for dBASE
    strConnection = _T("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;"
                       "Dbq=c:\\DatabasePath;");

    ODBC Driver for Excel
    strConnection = _T("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;"
        bq=C:\\DatabasePath\\DBSpreadSheet.xls;DefaultDir=c:\\databasepath;");

    ODBC Driver for Text
    strConnection = _T("Driver={Microsoft Text Driver (*.txt; *.csv)};"
            "Dbq=C:\\DatabasePath\\;Extensions=asc,csv,tab,txt;");

    ODBC Driver for Visual FoxPro
    strConnection = _T("Driver={Microsoft Visual Foxpro Driver};UID=;"
        "SourceType=DBF;SourceDB=C:\\DatabasePath\\MyDatabase.dbc;Exclusive=No");

    ODBC Driver for Access
    strConnection = _T("Driver={Microsoft Access Driver (*.mdb)};"
            "Dbq=c:\\DatabasePath\\dbaccess.mdb;Uid=;Pwd=;");


    ODBC Driver for SQL Server
    For Standard security:

    strConnection = _T("Driver={SQL Server};Server=MyServerName;"
            "Trusted_Connection=no;"
            "Database=MyDatabaseName;Uid=MyUserName;Pwd=MyPassword;");

    For Trusted Connection security (Microsoft Windows NT integrated security):

    strConnection = _T("Driver={SQL Server};Server=MyServerName;"
         "Database=myDatabaseName;Uid=;Pwd=;");


    ODBC Driver for Oracle
    For the current Oracle ODBC driver from Microsoft:

    strConnect = _T("Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;"
            "Uid=MyUsername;Pwd=MyPassword;");


    For the older Oracle ODBC driver from Microsoft:

    strConnect = _T("Driver={Microsoft ODBC Driver for Oracle};"
         "ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;");


    ODBC Driver for MySQL
    If you want to connect to a local database, you can use a connection string like the following:

    strConnect = _T("Driver={MySQL ODBC 3.51 Driver};Server=localhost;"
         "Database=MyDatabase;User=MyUserName;Password=MyPassword;Option=4;");


    ODBC Driver for AS400
    strConnect = _T("Driver={Client Access ODBC Driver (32-bit)};System=myAS400;"
          "Uid=myUsername;Pwd=myPassword;");

    ODBC Driver for SyBase
    strConnect = _T("Driver={Sybase System 10};Srvr=MyServerName;Uid=MyUsername;"
           "Pwd=myPassword;");

    ODBC Driver for Sybase SQL AnyWhere
    strConnect = _T("ODBC;Driver=Sybase SQL Anywhere 5.0;"
        "DefaultDir=C:\\DatabasePath\;Dbf=C:\\SqlAnyWhere50\\MyDatabase.db;"
        "Uid=MyUsername;Pwd=MyPassword;Dsn=\"\";");

    =================以下是OLE DB====================
    FOR
    {
    SQL
    MySQL
    AS400
    AD
    DB2
    Microsoft Jet
    OLAP
    Oracle
    FoxPro
    Index Server
    }
    OLE DB Provider for SQL Server
    For Standard security:

    strConnect = _T("Provider=sqloledb;Data Source=MyServerName;"
            "Initial Catalog=MyDatabaseName;"
            "User Id=MyUsername;Password=MyPassword;");

    For Trusted Connection security (Microsoft Windows NT integrated security):

    strConnect = _T("Provider=sqloledb;Data Source=MyServerName;"
            "Initial Catalog=MyDatabaseName;"
            "Integrated Security=SSPI;");

    OLE DB Provider for MySQL
    strConnection = _T("Provider=MySQLProv;Data Source=test");

    OLE DB Provider for AS400
    strConnect = _T("Provider=IBMDA400;Data source=myAS400;User Id=myUsername;"
         "Password=myPassword;");

    OLE DB Provider for Active Directory
    strConnect = _T("Provider=ADSDSOObject;User Id=myUsername;Password=myPassword;");

    OLE DB Provider for DB2
    If you are using a TCP/IP connection:

    strConnect = _T("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;");

    If you are using APPC connection:

    strConnect = _T("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
    Connecting to an Access file using the JET OLE DB Provider:
    Using Standard security:

    strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0;"
            "Data Source=C:\\DatabasePath\\MmDatabase.mdb;"
            "User Id=admin;Password=;");

    Connecting to an Excel Spreadsheet using the JET OLE DB Provider: strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0;"
            "Data Source=C:\\DatabasePath\\DBSpreadSheet.xls;"
            "Extended Properties=\"\"Excel 8.0;HDR=Yes;\"\";");


    Connecting to an Outlook 2000 personal mail box using the JET OLE DB Provider: (By J. Cardinal) strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0;Outlook 9.0;"
          "MAPILEVEL=;DATABASE=C:\\Temp\\;")


    Connecting to an Exchange mail box through JET: (By J. Cardinal) strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0;Exchange 4.0;"
          "MAPILEVEL=Mailbox - Pat Smith|;DATABASE=C:\\Temp\\;")


    OLE DB Provider for ODBC Databases
    If you want to connect with a Microsoft Access database:

    strConnect = _T("Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};"
            "Dbq=c:\\DatabasePath\\MyDatabase.mdb;Uid=MyUsername;Pwd=MyPassword;");

    If you want to connect with a SQL Server database:

    strConnect = _T("Provider=MSDASQL;Driver={SQL Server};Server=MyServerName;"
            "Database=MyDatabaseName;Uid=MyUsername;Pwd=MyPassword;");

    If you want to use DSN:

    strConnect = _T("Provider=MSDASQL;PersistSecurityInfo=False;"
            "Trusted_Connection=Yes;"
            "Data Source=MyDSN;catalog=MyDatabase;");

    OLE DB Provider for OLAP
    MicrosoftR OLE DB for Online Analytical Processing (OLAP) is a set of objects and interfaces that extends the ability of OLE DB to provide access to multidimensional data stores.

    strConnect = _T("Provider=MSOLAP;Data Source=MyOLAPServerName;"
         "Initial Catalog=MyOLAPDatabaseName;");

    Using a URL
    strConnect = _T("Provider=MSOLAP;Data Source=http://MyOLAPServerName/;"
         "Initial Catalog=MyOLAPDatabaseName;");

    Using SSL
    strConnect = _T("Provider=MSOLAP;Data Source=https://MyOLAPServerName/;"
         "Initial Catalog=MyOLAPDatabaseName;");

    OLE DB Provider for Oracle (from Microsoft)
    strConnect = _T("Provider=MSDAORA;Data Source=MyOracleDB;User Id=myUsername;"
         "Password=myPassword;");

    For Standard security:

    strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
            "User Id=myUsername;Password=myPassword;");

    strConnect = _T("Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;"
       "User Id=/;Password=;");


    OLE DB Provider for Visual FoxPro
    strConnect = _T("Provider=vfpoledb;"
         "Data Source=C:\\DatabasePath\\MyDatabase.dbc;");

    OLE DB Provider for Index Server
    strConnect = _T("provider=msidxs;Data Source=MyCatalog;");

     

     

     



    yan.kee / Xuite日誌 / 回應(1) / 引用(0) / 好文轉寄
  • 回應