Skip to content

Navigation Menu

Sign in
Sign up

SimplySQL within PowerShell Universal #148

Discussion options

Hi,

Did anyone get this to work with PowerShell Universal?
I'm trying to connect to an MySQL database using the local PowerShell 7.3.8 environment from the windows host.

The command I use (which works when i execute it in the local PS7 shell):
Open-MySqlConnection -Server "myserver" -ConnectionName "myconnection" -Database "mydb" -Credential $mycred -Port 3312

The Error i get (in PowerShell Universal):
[error] The type initializer for 'MySqlConnector.Core.ServerSession' threw an exception.

You must be logged in to vote

Hi again!

The issue can be solved by switching the PSU environment from ‚PS7‘ to ‚Integrated‘.
I don't have a detailed explanation, but it works now and I can continue with the development of my PSU app! Thanks for the great support!

Replies: 1 comment 9 replies

Comment options

@bononundelaine -- can you provide more error details? can you confirm which version of PS that PowerShell Universal is using? Can you confirm if other providers are working? (try the SQLIte provider -- its self-contained). Thanks

You must be logged in to vote
9 replies
Comment options

@bononundelaine -- this suggests there might be an issue with PowerShellUniversal -- I would report the issue to them. Especially since running your script in native PowerShell works fine.

Comment options

I downloaded PowerShellUniversal -- and I'm getting the same error you are, but I'm not getting it for the other providers... this suggests something about that the MySQLConnector nuget package is conflicting with the PowerShell Runspace that PowerShellUniversal is using.

Comment options

@bononundelaine -- look at this response from the PowerShell Universal forums:
https://forums.ironmansoftware.com/t/issue-with-powershell-module-simplysql/10669/3

They suggest using a minimal environment and see if that makes things work.

Comment options

Hi again!

The issue can be solved by switching the PSU environment from ‚PS7‘ to ‚Integrated‘.
I don't have a detailed explanation, but it works now and I can continue with the development of my PSU app! Thanks for the great support!

Answer selected by mithrandyr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /