Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2706
  • Last Modified:

SQL SERVER 2005 Create Assembly

Hi

I am trying to create an assembly in sql server 2005 so that I can use the functions inside the dll, This dll is working in production.

This is what I did and I got the following results after executing, Any inputs will be appreciated

Thanks

USE [XXXX]
GO
CREATE ASSEMBLY [Charge]
AUTHORIZATION [dbo]
FROM 'c:\WINDOWS\system32\Charge.dll'
WITH PERMISSION_SET = UNSAFE

Warning: The Microsoft .Net frameworks assembly 'system.xml.linq, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.' you are registering is not fully tested in SQL Server hosted environment.
Warning: The Microsoft .Net frameworks assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.' you are registering is not fully tested in SQL Server hosted environment.
Msg 10301, Level 16, State 1, Line 1
Assembly 'Charge' references assembly 'system.runtime.serialization, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
0
baylar
Asked:
baylar
  • 7
  • 4
1 Solution
 
Bhavesh ShahLead AnalysistCommented:
This is what i found it on net


In order for SQL Server to use an assembly, the assembly and all its dependent assemblies must be stored inside SQL Server. When you create assembly, SQL Server tries to find load the assemblies the original assembly uses from the same directory.  

 

This means since your assembly uses the ManagedDTS assembly, and the ManagedDTS assembly uses Windows.Forms, Msxml6_interop, etc, you need to load all those assemblies into the system. Microsoft.SQLServer.msxml6_interop.dll is located in the GAC on your system. Most of the assemblies you will need are either in Framework directory or %WINDIR%\assembly. To speed things up, you will want run create assembly on any assembly you see in a warning message so that SQL will only load it once, and not try to reload it from disk subsequently.
0
 
Bhavesh ShahLead AnalysistCommented:
check out this link also

http://support.microsoft.com/kb/922672
0
 
baylarAuthor Commented:
OK as per your instructions I ran the below but some new error, Can you please take a look…
I also tried with SAFE option but same thing.

CREATE ASSEMBLY [System.Core]
AUTHORIZATION [dbo]
FROM 'c:\WINDOWS\system32\System.Core.dll'
WITH PERMISSION_SET = unsafe

Warning: The Microsoft .Net frameworks assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.' you are registering is not fully tested in SQL Server hosted environment.
Msg 10327, Level 14, State 1, Line 1
CREATE ASSEMBLY for assembly 'System.Core' failed because assembly 'System.Core' is not authorized for PERMISSION_SET = UNSAFE.  The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission. If you have restored or attached this database, make sure the database owner is mapped to the correct login on this server. If not, use sp_changedbowner to fix the problem.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
baylarAuthor Commented:
HI
I think I am close...

Thanks for all your links, After altering database option TRUSTWORTHY to true I was able to do create assembly on some of the DLLs I was happy then until I reached a point where its keep on asking to register 'system.runtime.remoting’ while I was trying to register ‘system.enterpriseservices’ and vice-versa and I don’t know where to go from here

My whole intension is to use the methods of ‘Charge’ DLL from sql server in a way similar the frontend application is using to write to tables.


CREATE ASSEMBLY [system.enterpriseservices]
AUTHORIZATION [dbo]
FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\system.enterpriseServices.dll'
WITH PERMISSION_SET = unsafe
GO

Warning: The Microsoft .Net frameworks assembly 'system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment.
Warning: The Microsoft .Net frameworks assembly 'system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.' you are registering is not fully tested in SQL Server hosted environment.
Warning: The Microsoft .Net frameworks assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment.
Msg 10300, Level 16, State 2, Line 1
Assembly 'System.EnterpriseServices' references assembly 'system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.


CREATE ASSEMBLY [system.runtime.remoting]
AUTHORIZATION [dbo]
FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Runtime.Remoting.dll'
WITH PERMISSION_SET = unsafe
GO

Warning: The Microsoft .Net frameworks assembly 'system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.' you are registering is not fully tested in SQL Server hosted environment.
Warning: The Microsoft .Net frameworks assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment.
Warning: The Microsoft .Net frameworks assembly 'system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment.
Msg 10300, Level 16, State 1, Line 1
Assembly 'System.Web' references assembly 'system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.

0
 
Bhavesh ShahLead AnalysistCommented:
Wil get back 2u tomorow morning
0
 
Bhavesh ShahLead AnalysistCommented:

check out this one

http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/2d32a1e4-96f6-4ade-8400-f9bb63cfc25f

here they saying

I just tried this exact same statement on my SQL Server 2005 SP2 installation and it worked fine. I am guessing that your .NET framework installation especially System.Web is corrupt since it is refering to itself. Can you try it on any other system or try re-installing the .NET framework,
0
 
baylarAuthor Commented:
Today I tried this on the production box but the same error, I ran all this on sql server 2005, with SP3,  I might need to contact the person who have written this dll, The last thing I will try is to re-install .NET framework and will let you know.

Anyways thanks for your help and support, If any success I will post back to this thread.
0
 
Bhavesh ShahLead AnalysistCommented:
Dear author,
If last solution is also not workd out,i suggest that use Request attention Link,so higher level experts can giv their views.
0
 
baylarAuthor Commented:
Thanks Brich you have come long way to help with this, Finally it worked.....

1. registered the System.Web.dll from the Framework64 directory
2. used unsafe option for my dll

Now I can see my dll under assembilies inside sqlserver, now I need to learn how to access that dll, do you have any suggestions
0
 
Bhavesh ShahLead AnalysistCommented:
Dear Author,

Pls create new Q for it.
So you can get solution very quickly
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now