Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSSQL support in IronPython 3.4 #1746

Open
rajesh78 opened this issue Oct 25, 2023 Discussed in #1744 · 5 comments
Open

MSSQL support in IronPython 3.4 #1746

rajesh78 opened this issue Oct 25, 2023 Discussed in #1744 · 5 comments

Comments

@rajesh78
Copy link

Discussed in #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?

@slozier
Copy link
Contributor

slozier commented Oct 25, 2023

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

@kumarKovuru
Copy link

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)

@slozier
Copy link
Contributor

slozier commented Oct 26, 2023

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).

@kumarKovuru
Copy link

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)

@slozier
Copy link
Contributor

slozier commented Nov 2, 2023

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants