SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problem migrating CLR Assembly from 32-bit to 64-bit environment SQL 2005/OLEDB/VFP


Problem migrating CLR Assembly from 32-bit to 64-bit environment SQL 2005/OLEDB/VFP

Author
Message
chris.crowhurst
chris.crowhurst
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 8
Hi,

I am currently in the process of migrating our database server (which is Windows Server 2003 32-Bit, SQL2005) over to a VM environment which will be Windows 2008 R2 64-Bit, SQL 2005 64 Bit.

One of the issues I am currently facing is that I am having difficulty with the database integration which has been developed using a CLR Assembly (C#). This assembly when called uses OLE DB to connect to a legacy Visual FoxPro Database (V7), using the VFPOLEDB provider, and updates data in the database.

Under testing the new environment, this database integration fails. The OLEDB driver reports the following error any time an attempt is made to update the data :

“The 'VFPOLEDB.1' provider is not registered on the local machine. “

I did some further investigation and found out that the OLEDB driver is not supported in a 64-bit environment, but could be run in a 32-bit environment running under WOW64. I created a small test application in C# that would write some data using the OLEDB driver, complied it for x86 CPU and ran the test application. The test application ran fine and updated the data in the Visual FoxPro Application.

My next step is then to re-compile the CLR Assembly for x86 CPU and import it back into SQL2005. I do this without any issues but when I then try and then do an update I get the following message from SQL Server :

Msg 10314, Level 16, State 11, Procedure usp_UpdateFoxPro, Line 45
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65542. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'foxprointegration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b23e91ab0ea90eca' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
System.IO.FileLoadException:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
The statement has been terminated.

(I also get the same error when creating a small test CLR Assembly compiled for x86 CPU)

My question is how can I fix this error, or is it not possible to run 32-bit CLR Assemblies from a 64-Bit SQL Server ?

I would really like to get this solved as the whole point of moving to a 64 bit environment is to take advantage of the additional memory we can put on the server. If I have to still run in a 32-bit environment it kind of defeats the point of doing the migration, other than the fact the hardware needs replacing this year!
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40162 Visits: 14413
I am not sure you can target the x86 platform and have it run within an x64 instance as it will be executing in an x64 thread. You could target Any CPU or x64 but if you do that your VFP driver will need to be built for the 64-bit architecture which you said does not exist.

An option for you, run 32-bit SQL Server on 64-bit OS. It will relieve some of your memory issues (4GB user mode VAS instead of just 2GB (or 3GB with boot.ini switch)) and with AWE you can address more than 4GB for your buffer pool.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
chris.crowhurst
chris.crowhurst
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 8
Thanks for the reply.

Installing SQL Server as 32-bit mode would probably be the most effective option for me and not one I had considered before.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search