搜尋本站文章

顯示具有 .NET Framework 標籤的文章。 顯示所有文章
顯示具有 .NET Framework 標籤的文章。 顯示所有文章

2010-08-02

認識 MDAC、WDAC、SQL Server Native Client、檢查 MDAC 版本

MDAC、WDAC

程式設計師可以使用 MDAC\WDAC 來存取關連性(relational)與非關連性(non-relational)的資料來源。而這些資料來源包含了: Open Database Connectivity (ODBC)、ActiveX Data Objects (ADO) 或 OLE DB 等。

MDAC(Microsoft Data Access Components)

WDAC(Windows Data Access Components )
從 Windows Vista 開始,資料存取元件現在稱為 Windows Data Access Components 或 Windows DAC(WDAC)(原本是稱為 MDAC)。

請參考 MDAC\WDAC 現行的架構圖:

01_MDAC_WDAC Architecture

  • ADO:包含了 ADO(ActiveX Data Objects )、ADOMD(ADO Multi-Dimensional )、ADOX(ADO Extensions for DDL and Security) 等。
  • OLE DB:包含了 OLE DB Core Services、SQL Server OLE DB Provider、Oracle OLE DB Provider、OLE DB Provider for ODBC Drivers、Data Shape Provider 以及 Remote Data Provider 等。
  • ODBC(Open Database Connectivity):包含了 ODBC Driver Manager、SQL ODBC Driver 與 Oracle ODBC Driver 等。

MDAC/WDAC 的版本

請參考下表所示:

02_MDAC 版的清單

MDAC 2.6:
MDAC 2.6 RTM, SP1, and SP2 were included with Microsoft SQL Server 2000 RTM, SP1, and SP2, respectively.
Additionally, these MDAC service packs were released to the MDAC Web site in accordance with the Microsoft SQL Server 2000 service-pack release schedule.
You can install this version of MDAC and its service packs on Windows 2000, Windows Millennium Edition, Windows NT, Windows 95, and Windows 98 platforms.
This version of MDAC no longer is supported.

MDAC 2.7:
This version of MDAC was included with the Microsoft Windows XP RTM and SP1 operating systems.
You can install this version of MDAC and its service packs on Windows 2000, Windows Millennium, Windows NT, and Windows 98 platforms.
You can install this version on the Windows XP platform only through the operating system or its services packs.
This version of MDAC no longer is supported.

MDAC 2.8:
This version of MDAC was included with Windows Server 2003 and Windows XP SP2 and later.
You also can install this version of MDAC and its service packs on Windows 2000.
The 32-bit version of MDAC 2.8 also was released to the MDAC Web site at the same time that Windows Server 2003 was released to the customer.
The 64-bit version of MDAC 2.8 was released with the 64-bit version of Windows Server 2003 and Windows XP.

Windows Data Access Components (WDAC):
MDAC changed its name to WDAC - "Windows Data Access Components" since Windows Vista and Windows Server 2008.
WDAC is included as part of the operating system and is not available separately for redistribution. Serviceability for WDAC is subject to the life cycle of the operating system.
32-bit and 64-bit versions of WDAC are released with the 32-bit and 64-bit versions of the Windows operating systems, respectively.


若要檢查 MDAC 或 WDAC 的版本

檢查儲存在登錄中的版本資訊
雖然這不是檢查 MDAC 版本最可靠的方式,但所檢查的版本資訊登錄卻是仔細檢查此資訊一個很簡單的方式。(如果您沒有遇到與 MDAC 相關的問題的話)。

可在下列機碼中找到版本資訊:
HKEY_LOCAL_MACHINE\Software\Microsoft\DataAccess\FullInstallVer

  1. 若要檢查該登錄,請依照下列步驟執行:
  2. 在 「開始」 功能表上,按一下 「執行」。
  3. 在 「開啟」 文字方塊中,輸入 regedit 然後按一下 「確定」;如此便會啟動 「登錄編輯程式」。
  4. 在 「功能窗格」 中,向下展開至下列路徑:
    HKEY_LOCAL_MACHINE\Software\Microsoft\DataAccess
  5. 在 「詳細資料」 窗格中,查看 FullInstallVer 和 版本 的 「名稱」 欄。「資料」 欄中的每一個機碼都有相對應的版本資訊。
    完成之後,在 「登錄」 功能表上按一下 「結束」 以關閉 「登錄編輯程式」。

請參考下圖所示:

03_檢查儲存在登錄中的版本資訊

環境說明:

Windows Server 2008 R2 + SQL Server 2008 R2。


SQL Server Native Client


在 SQL Server 2005 版本,導入了 SQL Server Native Client,這是用於 OLE DB 和 ODBC 的獨立資料存取應用程式開發介面 (API)。
SQL Server Native Client 將 SQL OLE DB 提供者和 SQL ODBC 驅動程式結合為單一的原生動態連結程式庫 (DLL)。

SQL Server Native Client 可用於建立新的應用程式,或者加強需要利用 SQL Server 2005 所推出之新功能 (例如,Multiple Active Result Set (MARS)、使用者定義資料類型 (UDT)、查詢通知、快照集隔離和 XML 資料類型支援) 的現有應用程式。

SQL Server Native Client 介面提供了遠超過 MDAC/WDAC 的功能。

雖然 SQL Server Native Client 與 MDAC 都提供 SQL Server 資料庫的原生資料存取權,但是 SQL Server Native Client 是專為公開 SQL Server 2005 的新功能而設計,同時還保留了與舊版的回溯相容性。

選擇使用 SQL Server 2008 R2 Native Client 的時機

決定是否要使用 SQL Server Native Client 當做應用程式的資料存取技術時,您應該考慮許多因素。

對於新的應用程式而言,如果您正在使用 Microsoft Visual C# 或 Visual Basic 等 Managed 程式語言,而且需要存取 SQL Server 中的新功能,則應該使用 .NET Framework Data Provider for SQL Server (屬於 .NET Framework 的一部分)。

如果您正在開發以 COM 為基礎的應用程式,而且需要存取 SQL Server 所導入的新功能,則應該使用 SQL Server Native Client。
如果您不需要存取 SQL Server 的新功能,可以繼續使用 Microsoft Data Access Components (MDAC)。

對於現有的 OLE DB 和 ODBC 應用程式而言,主要的問題在於您是否需要存取 SQL Server 的新功能。
如果您有一個不需要 SQL Server 之新功能的完整應用程式,就可以繼續使用 MDAC。

但是,如果您需要存取這些新功能 (例如,新的 xml 資料類型),就應該使用 SQL Server Native Client。

SQL Server Native Client 和 MDAC 都可使用資料列版本控制來支援讀取認可的交易隔離,但是只有 SQL Server Native Client 可支援快照集交易隔離 (在程式設計的詞彙中,含有資料列版本控制的讀取認可交易隔離與讀取認可的交易相同)。


參考資料:
Data Access Technologies Road Map
http://msdn.microsoft.com/en-us/library/ms810810.aspx

Data Access and Storage
http://msdn.microsoft.com/zh-tw/data/default(en-us).aspx

使用 SQL Server 2008 R2 Native Client 的時機
http://technet.microsoft.com/zh-tw/library/ms130828.aspx

從 MDAC 將應用程式更新至 SQL Server Native Client
http://technet.microsoft.com/zh-tw/library/ms131035.aspx

Microsoft Data Access Components (MDAC) 版本記錄
http://support.microsoft.com/kb/231943

如何檢查 MDAC 版本
http://support.microsoft.com/kb/301202/zh-tw

MDAC 安裝程式問題的疑難排解指南
http://support.microsoft.com/kb/232060/zh-tw

Microsoft OLE DB 提供者的 Jet 和 Microsoft Access ODBC 驅動程式可用於僅 32 位元版本
http://support.microsoft.com/kb/957570

2008-10-19

【已經解決】:x64 環境開發 SQL Server Compact 3.5 遇到問題:無法載入 DLL 'sqlceme35.dll': 找不到指定的模組。請安裝 SQL Server Compact 3.5 SP1 即可解決此問題。





文章更新 2008/12/27:

感謝朋友「天涯」的分享解決方案:

在 SQL Server Compact 3.5 版本,並未支援 64 位元程式開發。但是在 SQL Server Compact 3.5 SP1 上,就有支援 64 位元程式開發。

以下是關於 SQL Server Compact 3.5 SP1 的相關資訊:
Microsoft SQL Server Compact 3.5 Service Pack 1 和適用於 Windows 桌上型電腦的 Synchronization Services for ADO.NET 1.0 版 Service Pack 1

版本: 3.5.5692.0
發佈日期: 2008/8/6
可下載的程式:
SSCERuntime-CHT-x64.msi
SSCERuntime-CHT-x86.msi

下載網址:
Microsoft SQL Server Compact 3.5 Service Pack 1 和適用於 Windows 桌上型電腦的 Synchronization Services for ADO.NET 1.0 版 Service Pack 1
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=dc614aee-7e1c-4881-9c32-3a6ce53384d9

下載檔案 64位元版本:SSCERuntime-CHT-x64.msi

參考資料:
KB955965:Description of SQL Server Compact 3.5 Service Pack 1
http://support.microsoft.com/default.aspx?scid=KB;%5bLN%5d;955965

Microsoft SQL Server Compact 3.5 Service Pack 1 線上叢書和範例
http://www.microsoft.com/downloads/details.aspx?FamilyId=07829770-73A7-41E4-880D-E74B1A353623&displaylang=zh-tw





在使用 Visual Studio 2008 開發 SQL Server Compact 3.5 資料庫,可能會遇到以下的問題。

適用環境:
x64 版本的作業系統,例如:Vista、Windows Server 2008 等等。


遇到的錯誤訊息:



無法載入 DLL 'sqlceme35.dll': 找不到指定的模組。 (發生例外狀況於 HRESULT: 0x8007007E)

System.DllNotFoundException 未處理
Message="無法載入 DLL 'sqlceme35.dll': 找不到指定的模組。 (發生例外狀況於 HRESULT: 0x8007007E)"
Source="System.Data.SqlServerCe"
TypeName=""
StackTrace:
於 System.Data.SqlServerCe.NativeMethods.SafeRelease(IntPtr& ppUnknown)
於 System.Data.SqlServerCe.SqlCeCommand.ReleaseNativeInterfaces()
於 System.Data.SqlServerCe.SqlCeCommand.Finalize()
InnerException:


請參考下圖所示的錯誤:




可能的處理方式如下:
這可能是因為目前sqlceme35.dll等相關元件,尚未支援x64位元的版本。處理方式:
1. 在右邊的「方案總管」,點選先前建立的專案「資料同步服務」。
2. 滑鼠右鍵,選擇「屬性」。
3. 在左邊的專案屬性視窗內,點選「建置」頁面。
4. 在「平台目標」方塊,改選取為「x86」。

請參考下圖所示:


5. 點選上方的工作選單「檔案」\「全部儲存」,再關閉專案屬性的設定視窗。

參考文件:

SQL Server Compact 3.5 和 Visual Studio
http://msdn.microsoft.com/zh-tw/library/aa983341.aspx

64 位元程式開發 針對使用 Visual Studio 和 SQL Server Compact 3.5 進行的 64 位元程式開發,[進階編譯器設定] 中的 [目標 CPU] 選項必須明確設定為 [x86]。當 [目標 CPU] 設定為預設值 [任何 CPU] 時,將會出現「無法載入 sqlceme35.dll」這個訊息。因此請務必設定專案屬性中,[進階編譯器設定] 的 [目標 CPU] 選項。


HOW TO:連同應用程式部署 SQL Server Compact 3.5 資料庫
http://msdn.microsoft.com/zh-tw/library/aa983326.aspx


Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
http://forums.microsoft.com/msdn/showpost.aspx?postid=2616204&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=0

x64 and SQL Compact
http://erikej.blogspot.com/2008/01/x64-and-sql-compact.html


2007-11-13

讓 .NET 跨平台執行的猴子[Mono]



.NET Framework 已被提交到 ECMA/ISO 成為公開的標準。目前筆者找到可以使用 Mono Project 來讓 .NET 程式在 Linux, Solaris, Mac OS X, Windows, and Unix 等作業系統上面執行。關於硬體平台部分,目前 Mono 也已經支援 32-bit 與 64-bit 的 x86、PowerPC、SPARC等主機。




Mono 計畫包含 Runtime、 Classes、 Gtk# 、ASP.NET、ADO.NET、C# Compiler 與 VB Compiler。主要的功能是:Multi-platform. Based on the ECMA/ISO standards. Runs ASP.NET and Winforms applications. Can run .NET, Java, Python and more. Open Source, Free Software. Commercially supported. Comprehensive technology coverage.


相關的軟體:

  • DebianPackages:asp.net-examples - demo pages for ASP.NET infrastructure
  • DebianPackages:libmono-dev - libraries for the Mono interpreter - Development files
  • DebianPackages:libmono0 - libraries for the Mono interpreter
  • DebianPackages:mono - The Mono .NET development environment
  • DebianPackages:mono-assemblies-arch - architecture specific Mono .NET class libraries
  • DebianPackages:mono-assemblies-base - the Mono .NET class libraries
  • DebianPackages:mono-common - common files for the Mono CLI runtimes
  • DebianPackages:mono-jay - LALR(1) parser generator oriented to Java/.NET
  • DebianPackages:mono-jit - fast CLI (.NET/Mono) JIT compiler
  • DebianPackages:mono-mcs - the Mono C# compiler
  • DebianPackages:mono-mint - generic CLI (.NET/Mono) code interpreter
  • DebianPackages:mono-utils - Mono utilities
  • DebianPackages:mono-xsp - simple web server to run ASP.NET applications

Mono project 由 2001 年發展至今,已經可以支援 .NET Framework: 1.0, 1.1, 2.0 與 3.0 。目前最新的版本是 1.2.5,主要支援以下的功能:

  • VB.NET compiler and runtime were released.
  • 2.0 support completed for Web Services (Generics).
  • ASP.NET WebForms are complete (except for WebParts).
  • Extensive improvements to Windows.Forms and 2.0 updates for it.
  • Release of Mono Migration Assistant.
  • Partial C# 3 support and System.Core assembly.
  • System.Media implemented.
  • HTTPS support in HttpListener.
  • 2.0 Socket API.
  • Improved fidelity and performance of System.Drawing, added support for Metafiles.
  • ADO.NET 2.0 updates, and support for output parameters on stored procedures.

... 等等

計畫在 Mono 2.0 版本中,加上:

  • Complete core class libraries support.
  • Windows.Forms 2.0 (preview).
  • Visual Basic Compiler (VBNC)
  • Updated System.Drawing to use Pango.
  • Tools for Windows Developers (Moma, Gendarme for portability).
  • GUI Debugger.


    可以參考以下的資料計畫首頁: http://www.go-mono.com/

開發手冊: http://go-mono.com/tutorial/
http://www.mono-project.com/Main_Page

Mono的 Wiki說明 http://zh.wikipedia.org/wiki/Mono

比較有趣的問題是:
何謂 "Mono"呢?"Mono" 這個字是西班牙語的 "猴子" 之意。
因為開發的專案團隊喜歡 "猴子"。


Best Regards

Derrick Chen 德瑞克