cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Cannot install assembly on SQL Server 2008

Former Member
0 Likes
8,000

made some library and want to use it as CLR assembly in MSSQL. The point is that my lib have the reference to 'iAnywhere.Data.SQLAnywhere' lib which I cannot install. The error is:

Assembly 'iAnywhere.Data.SQLAnywhere' could not be installed because existing policy would keep it from being used.

I have implemented the recommendations and now my SQL looks like:

USE DB_Control GO

ALTER DATABASE DB_Control SET TRUSTWORTHY ON WITH ROLLBACK IMMEDIATE
GO

ALTER DATABASE DB_Control SET TRUSTWORTHY ON
GO

exec sp_configure 'show advanced options', 1;
GO

RECONFIGURE;
GO

exec sp_configure 'clr enabled', 1;
GO

RECONFIGURE;
GO

IF EXISTS (
SELECT 1
FROM sys.assemblies a
WHERE a.name = 'ClrSqlMediator'
)
    EXEC sp_executesql N'DROP ASSEMBLY ClrSqlMediator'
GO

CREATE ASSEMBLY [iAnywhere.Data.SQLAnywhere]
AUTHORIZATION sa
FROM '~\\Debug\\iAnywhere.Data.SQLAnywhere.dll'
WITH PERMISSION_SET = UNSAFE
GO

CREATE ASSEMBLY ClrSqlMediator
AUTHORIZATION sa
FROM '~\\Debug\\SQLMediator.dll'
WITH PERMISSION_SET = UNSAFE
GO

Does anybody know how to fix this?

View Entire Topic
jeff_albion
Product and Topic Expert
Product and Topic Expert

This is probably closer to a Microsoft SQL Server question than a SQL Anywhere question, so you may want to check out other Microsoft SQL Server resources for further assistance.


The deployment requirements for the SQL Anywhere ADO.NET assembly are noted in the documentation - ensuring that the native DLLs can be located via the SQL Server's PATH environment variable is likely the most important point for deploying the unmanaged DLLs.

There is a stackoverflow question that seems to suggest this might be due to a mismatch of CLR versions. It seems that there's an open question of which CLR version currently runs on SQL Server, depending on environment configuration - to determine your current configuration, you will need to run the SQL:

select * from sys.dm_clr_properties

Perhaps you need to load the 4.0 CLR ADO.NET provider (iAnywhere.Data.SQLAnywhere.v4.0.dll) to match the 4.0 CLR version loaded in Microsoft SQL Server...?