關於數據庫連接字符串問題(第五部分連接access-2007)

其實在實際的應用過程中,我們不光是採用有服務器型的大型數據庫,也經常使用文件型的數據庫,例如access-2007,本文就列舉一下access-2007的連接字符串的書寫,一邊於初學者能夠正確的連接上access-2007文件,進行進一步操作。

Connection strings for Access 2007

 

Community Forums
Find solutions and post questions regarding connection string related issues.

 

ACE OLEDB 12.0

Type OLE DB Provider
Usage Provider=Microsoft.ACE.OLEDB.12.0
Manufacturer Microsoft

Standard security

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
 
 

With database password

This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;

Some reports of problems with password longer than 14 characters. Also that some characters might cause trouble. If you are having problems, try change password to a short one with normal characters.

 
 

DataDirectory functionality

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\myAccess2007file.accdb;Persist Security Info=False;
 
 

 

.NET Framework Data Provider for OLE DB

Type .NET Framework Wrapper Class Library
Usage System.Data.OleDb.OleDbConnection
Manufacturer Microsoft

Bridging to ACE OLEDB 12.0

This is just one connection string sample for the wrapping OleDbConnection class that calls the underlying OLEDB provider. See respective OLE DB provider for more connection strings to use with this class.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
 
 

 

Microsoft Access accdb ODBC Driver

Type ODBC Driver
Usage Driver={Microsoft Access Driver (*.mdb, *.accdb}
Manufacturer Microsoft

Standard Security

Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;Uid=Admin;Pwd=;
 
 

Workgroup

Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\mydatabase.accdb;SystemDB=C:\mydatabase.mdw;

No changes were made to the .mdw file format for Office Access 2007. The Office Access 2007 Workgroup Manager creates .mdw files that are identical to those that are created in Access 2000 through Access 2003. The .mdw files that are created in those earlier versions can be used by databases in Office Access 2007.

 

發佈了94 篇原創文章 · 獲贊 13 · 訪問量 68萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章