ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

MSSQL support in IronPython 3.4

Open rajesh78 opened this issue 3 years ago • 5 comments

Discussed in https://github.com/IronLanguages/ironpython3/discussions/1744

Thanks to @BCSharp. I am able to create the dot net project by following the tips from the above link by @BCSharp.

The new problem i am facing is - I am not able to call the api if it involves a MSSQL database interaction. I am getting the below error. "SystemError: Microsoft.Data.SqlClient is not supported on this platform."

Any information if Iron Python support the MSSQL interaction?

rajesh78 avatar Oct 25 '23 09:10 rajesh78

No idea how you're loading your DLLs, but you're most likely using the wrong Microsoft.Data.SqlClient.dll file.

slozier avatar Oct 25 '23 14:10 slozier

Hi @slozier @BCSharp I am also facing the same issue, below are the steps that I tried.

Step 1: I have created a Class library project in .Net6.0 Step 2: I have installed below packages through nuget package manager Microsoft.EntityFrameworkCore.Tools Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore

Step 3: I have created DatabaseContext through entiryframework. i have used SQL server. Step 4: The C# Library works fine when I tested with a Console Application. Step 5: I am getting an error “SystemError: Microsoft.Data.SqlClient is not supported on this platform” in IronPython when i load the Class Library DLL(Step 1)

kumarKovuru avatar Oct 26 '23 10:10 kumarKovuru

When you nuget install the package, the Microsoft.Data.SqlClient.dll that ends up in the main application folder is just a stub assembly that throws PlatformNotSupportedException on everything. The DLL you actually want is under the runtimes folder. If you look at your console application folder there's probably a <assembly name>.deps.json which .NET uses to find the correct DLL to load. This is probably why the console application works (I assume if you were to remove the deps file it'd start throwing PNSE).

slozier avatar Oct 26 '23 13:10 slozier

Hi @slozier, Thanks for the response. I tried the below steps but got the same error "SystemError: Microsoft.Data.SqlClient is not supported on this platform"

Step 1: Copied the folders inside the runtimes folder that are generated on publish. Step 2: Pasted them inside the path IronPython.3.4.1\net6.0\runtimes (this is after unzip of IronPython.3.4.1)

kumarKovuru avatar Oct 27 '23 03:10 kumarKovuru

@kumarKovuru I think you misunderstood. I was trying to explain the the .deps.json file pointing to the assemblies in the runtimes folder is required by .NET to find the correct assembly. Another option that might work would be putting the DLLs from the runtimes folder in the root - which might be fine if you don't care about the cross-platform aspect of things...

slozier avatar Nov 02 '23 13:11 slozier