-
Notifications
You must be signed in to change notification settings - Fork 29
Hi,
I just installed the newest version 2.0.2.70 on Powershell Core 7.4.2.
This is my connection script to MariaDB:
$c = [pscredential]::new($dbUser, (ConvertTo-SecureString -Force -AsPlainText $dbPass)) Open-MySqlConnection -connectionname 'MariaDB' -Server $dbHost -Database $dbName -Credential $c $testconnection = Test-SqlConnection -ConnectionName 'MariaDB' Write-Host $testconnection
Dot Net installed:
ComputerName : localhost
=4.x : 4.8+
v4\Client : Installed
v4\Full : Installed
v3.5 : Installed
v3.0 : Installed
v2.0.50727 : Installed
v1.1.4322 : Not installed (no key)
And that is the error I get:
Could not load type 'Oracle.ManagedDataAccess.Client.OracleDBAPrivilege' from assembly | 'Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.
How can I solve this issue? What is the reason?
All reactions
Replies: 2 comments 12 replies
@Myjestic -- you are launch pwsh and importing the module and then trying to open a connection, correct? i.e. you are using the standard powershell 7 host and not a custom host?
All reactions
Hello @mithrandyr,
I'm using Powershell Core 7.4.2 on Windows Server 2019. I installed SimplySQL with -scope AllUsers. I'm using the default host.
I got it working an hour ago. I'll explain what the reason is and what my workaround was.
I just found out that I have a second Oracle.ManagedDataAccess.dll in the following location. C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle.ManagedDataAccess\v4.0_4.122.1.0__89b483f429c47342\Oracle.ManagedDataAccess.dll
If I rename this DLL to _Oracle.ManagedDataAccess.dll and open the powershell again, your module works like a charm as it now loads the Oracle.ManagedDataAccess.dll from the SimplySQL structure.
I may have some apps that need the renamed DLL. However, this may only be a temporary workaround. I tried unloading existing assemblies and then importing SimplySql, but everything I tried was unsuccessful. I think this is because the assembly is loaded when the Powershell CLI starts.
Maybe you can find a solution for this setup.
Best regards.
All reactions
@Myjestic -- yeah, a DLL in the global cache could be a problem, but it shouldn't. I think I may an issue in assembly loading logic and in how the module is structured. Ideally, everything that is related to the providers, should be in a Assembly Load Context and therefore completely isolated (thus, when my module needs something, it only interacts with my packaged DLLs). However, this is not happening now, what is particularly weird is that you are using the MySql provider but the issue arises with the Oracle provider DLL. I'm going to do some additional digging. Thanks for bringing this to my attention!
All reactions
@Myjestic -- Have you tried the latest release of SimplySql? As far as I can tell, I've fixed the issue where other providers were loading when they didn't need to.
All reactions
$PSVersionTable
you will want to look closely at the error stack $error for more details. The fact that it says "the assembly architecture is not compatible with the current process architecture" suggests that something is off. is this an ARM machine?
All reactions
$PSVersionTableyou will want to look closely at the error stack
$errorfor more details. The fact that it says "the assembly architecture is not compatible with the current process architecture" suggests that something is off. is this an ARM machine?
Did you read my last message?
All reactions
apologies -- the module is not compiled against ARM architectures -- you could put in a request (issue, enhancement) for this and I can look into it. sorry for the confusion.
All reactions
@magic-happenz -- ARM support has been added for OSX.