Re: [Ikvm-developers] help | ikvmc | CLR | SS2012 | .NET 4.0
Brought to you by:
jfrijters
|
From: Akshat S. <nas...@gm...> - 2014-03-14 10:57:10
|
On 14 March 2014 16:03, Akshat Sharma <nas...@gm...> wrote: > Fellow Developers, > > I have a situation in hand and was hoping if you could help me here. > > Background : > I have a piece of code in Java, my aim was to convert the resultant jar > into a dll and then use this dll in CLR integration for SQL Server 2012. > > Process followed : > Java - its a single class with imports as > import java.io.UnsupportedEncodingException; > import javax.crypto.spec.IvParameterSpec; > import javax.crypto.spec.SecretKeySpec; > import org.apache.commons.codec.binary.Base64; <commons-code-1.6.jar> > > I first converted the dependent jar into a dll > then the main jar into a dll > > ikvmc -out:commons-codec-1.6.dll commons-codec-1.6.jar > ikvmc -out:cipher.dll cipher.jar -r:commons-codec-1.6.dll > > I made a small project in c# and tried to use this dll, it worked like a > charm. > > The problem : > The real objective was to make this dll available in SQL Server 2012. > Now, when I try to create an assembly in SQL Server 2012 using this jar, > which is placed in the bin folder of ikvmc so at runtime all dependent > dll's are available. > > CREATE ASSEMBLY cipher from 'd:...\ikvm\bin\cipher.dll' WITH > PERMISSION_SET = SAFE > > "Msg 6213, Level 16, State 1, Line 1 > CREATE ASSEMBLY failed because method "getAttribute" on type > "java.text.AttributedString" in safe assembly "IKVM.OpenJDK.Text" has a > synchronized attribute. Explicit synchronization is not allowed in safe > assemblies." > > so I went with unsafe > CREATE ASSEMBLY cipher from 'd:...\ikvm\bin\cipher.dll' WITH > PERMISSION_SET = UNSAFE > > "Msg 10301, Level 16, State 1, Line 1 > Assembly 'cipher' references assembly 'system.drawing, 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: 2(The system cannot find > the file specified.)). Please load the referenced assembly into the current > database and retry your request." > > So I thought it is looking for version 2 of this specific dll and not able > to find it, so I searched around and felt that placing the version two of > System.Drawing and System.Windows.Forms in the bin might help, which, > didn't. > > "Warning: The Microsoft .NET Framework assembly 'system.drawing, > version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, > processorarchitecture=msil.' you are registering is not fully tested in the > SQL Server hosted environment and is not supported. In the future, if you > upgrade or service this assembly or the .NET Framework, your CLR > integration routine may stop working. Please refer SQL Server Books Online > for more details. > Msg 6586, Level 16, State 1, Line 1 > *Assembly 'System.Drawing' could not be installed because existing policy > would keep it from being used.*" > > What I could deduce was that CLR Integration for SQL Server 2012 requires > that all dependency should be dotnet 4 at least and as this dll is not, it > fails. > > What do I need to do to get this running ? > > Any help will be much appreciated !!! > > P.S : My dotnet framework knowledge is below par so don't mind any > senseless comment I might have made out there. > > -- > Kind Regards, > Akshat > -- Kind Regards, Akshat |