OLE DB Connect String (Access 2007)

連線到資料庫的 OLE DB 用法,一般來說,可以使用:
1. *.udl 連線字串記錄檔
2. 程式中直接用連線字串

以下是各類型資料庫連線字串的範例:

  1. MySQL
    Provider=OleMySql.MySqlSource.1;Persist Security Info=False;User ID=root;Data Source=localhost;Activation="";Mode=Read;Trace="";Initial Catalog=db;Command Time Out=600
  2. SQL Server
    Provider=SQLOLEDB.1;Password=_pw_;Persist Security Info=True;User ID=_id_;Initial Catalog=_db name_;
    Data Source=_ip_ or . or _電腦名稱_ or (local)
  3. Access 97
    Provider=Microsoft.Jet.OLEDB.3.51;
    Persist Security Info=False;
    Data Source=C:\mdb\books.mdb
  4. Access 2000 (有設定密碼)
    Provider=Microsoft.Jet.OLEDB.4.0;
    Persist Security Info=False;
    Data Source=C:\mdb\books.mdb;
    Jet OLEDB:Database Password=_pw_
  5. Access 2007 (有設定密碼)
    Provider=Microsoft.ACE.OLEDB.12.0;
    Persist Security Info=False;
    Data Source=MyDatabaseName.accdb;
    Jet OLEDB:Database Password=_pw_

 

附註:
   Access 2007 database (.accdb ext)
   Excel 2007 workbook (.xlsm ext)
   ACE (Access Connectivity Engine)

沒有留言: