2011-06-12 15 views
1

我試圖通過CLR程序集在SQL Server 2008中使用Chilkat加密庫。由於Chilkat庫如何放在一起(請參閱下面的消息),我無法直接執行此操作,因此需要創建一個引用Chilkat庫的包裝類,然而它完全按照SQL Server的要求進行管理。如何將Chilkat庫合併到SQL Server CLR

下面是我詢問如何通過SQL服務器直接連接他們的庫時奇爾卡特的反應(短版本是你不能)。

The Chilkat .NET assembly is a mixed-mode assembly, meaning that the implementation is written in C++ and compiles to native code. The outer layer is a managed interface. I've learned from other customers in the past that in this situation you can solve the problem by creating a simple wrapper class library in Visual Studio (fully managed) where the wrapper assembly references the Chilkat assembly, and the SQL Server objects instead reference your wrapper assembly. Given that you're probably only calling a handful of Chilkat methods (and properties), it shouldn't be much work to write the few methods to forward the call to the wrapped Chilkat object, and return the result.

好的。所以這是問題。當我在Visual Studio 2008中創建一個CLR項目時,我完全無法添加對Chilkat庫(或任何其他相關事項)的引用。有沒有瀏覽選項卡/按鈕/鏈接或其他添加額外的參考庫。根本不在那裏。

在我被迫使用Clipper或dBase3 +之前請幫忙!

情況:SQL Server 2008中,Visual Studio 2008中,奇爾卡特評價庫2011年4月

回答

1

SQL Server是一個有點挑剔什麼CLR組件,它會允許加載和Visual Studio阻止你加入任何舊組裝參考很好。

這是因爲你需要通過你的數據庫中的「可編程性」節點下找到新議會工具加載第三方組件(右鍵單擊組件),或使用CREATE ASSEMBLY

這使SQL服務器有機會檢查程序集並進行驗證,以確保它是用於SQL CLR集成的支持類型。它這樣做是爲了確保程序集不可能殺死SQL服務器或導致穩定性問題。

SQL聯機叢書的這一部分包含SQL CLR限制:

CLR Integration Programming Model Restrictions

的Chilikat組件將在PEVerify試驗(下EXTERNAL_ACCESS部分中所描述),因爲混合模式組件containing unmanaged functions是不可驗證的類型安全代碼失敗。

如果試圖安裝一個無法驗證的混合模式組裝,那麼你會得到一個錯誤,如:

CREATE ASSEMBLY for assembly 'ChilkatDotNet2' failed because assembly 'ChilkatDotNet2' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub. (Microsoft SQL Server, Error: 6544)

有一個discussion thread here覆蓋這個話題和一些建議的變通。

相關問題