Global Data Management Forum

 View Only
Expand all | Collapse all

Net.IBM.Data.Db2-osx not working

  • 1.  Net.IBM.Data.Db2-osx not working

    Posted Fri April 05, 2024 10:44 AM
    Edited by Piper Wilson Wed April 10, 2024 09:42 AM

    Hello,

    I have a dotnet core project using Net.IBM.Data.Db2 and it works with both Windows and Linux. I am now trying to get it to run on a Apple Macbook M3 Pro, however, it fails at run time with the following error:

    System.IO.FileNotFoundException: Could not load file or assembly 'IBM.Data.Db2, Version=8.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208'. The system cannot find the file specified.

    My console app contains the following code.

    ConsoleApp1.csproj:

    <Project Sdk="Microsoft.NET.Sdk">
    
        <PropertyGroup>
            <OutputType>Exe</OutputType>
            <TargetFramework>net8.0</TargetFramework>
            <ImplicitUsings>enable</ImplicitUsings>
            <Nullable>enable</Nullable>
        </PropertyGroup>
    
        <ItemGroup>
            <PackageReference Include="Dapper" Version="2.1.37" />
            <!-- <PackageReference Include="Net.IBM.Data.Db2" Version="8.0.0.200" Condition="$([MSBuild]::IsOsPlatform('Windows'))" /> -->
            <!-- <PackageReference Include="Net.IBM.Data.Db2-lnx" Version="8.0.0.200" Condition="$([MSBuild]::IsOsPlatform('Linux'))" /> -->
            <!-- <PackageReference Include="Net.IBM.Data.Db2-osx" Version="8.0.0.200" Condition="$([MSBuild]::IsOsPlatform('OSX'))" /> -->
            <PackageReference Include="Net.IBM.Data.Db2-osx" Version="8.0.0.200" />
    </ItemGroup>
    
    </Project>

    Program.cs:

    // See https://aka.ms/new-console-template for more information
    using IBM.Data.Db2; // note: this is correct, Net.IBM.Data.Db2 does not work
    using Dapper;
    using System.Data;
    
    Console.WriteLine("Start");
    
    string CONNECTION_STRING = "Server=db.foo.com:50000;Database=foo;UID=foo;PWD=bar;";
    
    var sql = "select * from ST004.students";
    using (var connection = new DB2Connection(CONNECTION_STRING))
    {
        var rows = await connection.QueryAsync(sql);
        Console.WriteLine(rows);
    }
    
    Console.WriteLine("End");

    The above throws the following run time error:

    Exception has occurred: CLR/System.IO.FileNotFoundException
    An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Private.CoreLib.dll: 'Could not load file or assembly 'IBM.Data.Db2, Version=8.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208'. The system cannot find the file specified.'
       at Program.<<Main>$>d__0.MoveNext() in /Users/me/dev/ConsoleApp1/ConsoleApp1/Program.cs:line 17
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
       at Program.<Main>$(String[] args) in /Users/me/dev/ConsoleApp1/ConsoleApp1/Program.cs:line 6
       at Program.<Main>(String[] args)

    The same project works perfectly fine on Windows and Linux so I'm at a loss as to what could be wrong.



    ------------------------------
    Tariq M
    ------------------------------



  • 2.  RE: Net.IBM.Data.Db2-osx not working

    Posted Thu April 11, 2024 09:13 AM
    Edited by Piper Wilson Mon April 29, 2024 11:53 AM

    I too faced a similar issue.



    ------------------------------

    ------------------------------



  • 3.  RE: Net.IBM.Data.Db2-osx not working

    Posted Thu April 11, 2024 09:35 AM

    Maybe this can help.

    This is the Readme.txt file from cldriver directory.

    ===================================================
    README for IBM Data Server Driver for ODBC and CLI
    ===================================================
     
    1. Linux or Unix
    2. Windows
    3. Mac
     
    1. Linux or Unix
    ================
     
        1. Create a directory for installation of the IBM Data Server Driver for ODBC and CLI software.
     
              mkdir $HOME/db2_cli_odbc_driver
     
        2. Copy the IBM Data Server Driver for ODBC and CLI software (vxx_xx_odbc_cli.tar.gz) into the above directory.
     
              cp vxx_xx_odbc_cli.tar.gz $HOME/db2_cli_odbc_driver
     
        3. Extract IBM Data Server Driver for ODBC and CLI.
     
              gunzip vxx_xx_odbc_cli.tar.gz
              tar -xvf vxx_xx_odbc_cli.tar
     
        4. Export the following environment variables.
     
              export DB2_CLI_DRIVER_INSTALL_PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver
              export LD_LIBRARY_PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export LIBPATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export LIBPATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/bin:$PATH
              export PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/adm:$PATH
     
        5. To connect to DB2 for z/OS Server download the license file db2consv_t.lic and copy to the license folder.
     
              $HOME/db2_cli_odbc_driver/odbc_cli/clidriver/license
     
    2. Windows
    ==========
     
        1. Create a directory for installation of the IBM Data Server Driver for ODBC and CLI software.
     
              mkdir C:\CDRIVER\
     
        2. Copy the IBM Data Server Driver for ODBC and CLI software (ibm_data_server_driver_for_odbc_cli.zip) into the above directory.
     
              cp ibm_data_server_driver_for_odbc_cli.zip C:\CDRIVER\
     
        3. Extract the IBM Data Server Driver for ODBC and CLI.
     
        4. Install the IBM Data Server Driver for ODBC and CLI. Navigate to the folder C:\CDRIVER\ibm_data_server_driver_for_odbc_cli\clidriver\bin and
           run the below command.
     
              db2cli install -setup
        5. The default common application data path will be located under C:\ProgramData\IBM\DB2\C_CDRIVER_ibm_data_server_driver_for_odbc_cli_clidriver.
     
        6. To connect to DB2 for z/OS Server, download the license file db2consv_t.lic and copy to the license folder.
     
              C:\CDRIVER\ibm_data_server_driver_for_odbc_cli\clidriver\license
     
    3. Mac
    ======
     
        1. Create a directory for installation of the IBM Data Server Driver for ODBC and CLI software.
     
              mkdir $HOME/db2_cli_odbc_driver
     
        2. Copy the IBM Data Server Driver for ODBC and CLI software (vxx_xx_odbc_cli.tar.gz) into the above directory.
     
              cp vxx_xx_odbc_cli.tar.gz $HOME/db2_cli_odbc_driver
     
        3. Extract IBM Data Server Driver for ODBC and CLI.
     
              gunzip vxx_xx_odbc_cli.tar.gz
              tar -xvf vxx_xx_odbc_cli.tar
     
        4. Export the following environment variables.
     
              export DB2_CLI_DRIVER_INSTALL_PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver
              export DYLD_LIBRARY_PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export LD_LIBRARY_PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export LIBPATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/lib
              export PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/bin:$PATH
              export PATH=$HOME/db2_cli_odbc_driver/odbc_cli/clidriver/adm:$PATH
     
    5. To connect to DB2 for z/OS Server,download the license file db2consv_t.lic and copy to the license folder.
     
              $HOME/db2_cli_odbc_driver/odbc_cli/clidriver/license
     
    =============================================================
    Configuring and validating the IBM Data Server Driver Package
    =============================================================
     
    Testing connectivity to the database
    https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.install.doc/doc/t0070358.html

    ============
    Useful Links
    ============
     
    Supported database application programming interfaces
    https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.gs.doc/doc/c0007011.html
     
    IBM data server driver configuration file
    https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.config.doc/doc/c0054555.html



    ------------------------------
    Peter Czurak
    ------------------------------



  • 4.  RE: Net.IBM.Data.Db2-osx not working

    Posted Fri April 12, 2024 01:55 AM

    Hi.

     apologies for the inconvenience and we are looking into this and will get back to you soon. 

    Thanks 

    Vishwa



    ------------------------------
    Hosathota Vishwanatha
    ------------------------------



  • 5.  RE: Net.IBM.Data.Db2-osx not working

    Posted Mon April 15, 2024 09:19 AM

    Hi Tariq,

     at present we have support for M1/M2 and are yet to validate for M3. We suspect some structural changes in M3 which is affecting this. Can you please approach IBM tech support and open a case so that we can meet you and troubleshoot?

    Thanks

    Vishwa



    ------------------------------
    Hosathota Vishwanatha
    ------------------------------



  • 6.  RE: Net.IBM.Data.Db2-osx not working

    Posted Mon April 15, 2024 03:39 PM

    Hey Vishwa, how do I contact IBM tech support?



    ------------------------------
    Tariq M
    ------------------------------



  • 7.  RE: Net.IBM.Data.Db2-osx not working

    Posted Wed April 17, 2024 07:09 AM
      |   view attached

    Hi Tariq,

    Can you please confirm which .NET installer you have used? We have support for x64 and our package works fine with it.

    If you are using ARM64, it is unsupported and may not work.

    For more information see the screenshot.



    ------------------------------
    Naveenkumar N L
    ------------------------------



  • 8.  RE: Net.IBM.Data.Db2-osx not working

    Posted Wed April 17, 2024 01:24 PM

    I'm using an Apple Macbook M3 Pro so I'm using the Arm64 dotnet sdk.

    I can't use the x64 version.



    ------------------------------
    Tariq M
    ------------------------------



  • 9.  RE: Net.IBM.Data.Db2-osx not working

    Posted Wed April 17, 2024 01:25 PM

    Is there any plan to add Arm64 support?



    ------------------------------
    Tariq M
    ------------------------------



  • 10.  RE: Net.IBM.Data.Db2-osx not working

    Posted Thu April 18, 2024 05:15 AM

    Hi, 

     there is no immediate plan to provide support but will be taken up in our future list. Can you please open an AHA request in the below link and let us know.

    https://ibm-data-and-ai.ideas.aha.io/ideas?project=DB2CON 

    Thanks

    Vishwa



    ------------------------------
    Hosathota Vishwanatha
    ------------------------------



  • 11.  RE: Net.IBM.Data.Db2-osx not working

    Posted Thu April 18, 2024 09:24 AM

    Created request: https://ibm-data-and-ai.ideas.ibm.com/ideas/DB24LUW-I-1962



    ------------------------------
    Tariq M
    ------------------------------



  • 12.  RE: Net.IBM.Data.Db2-osx not working

    Posted Fri April 19, 2024 01:28 AM

    Hi Tariq,

     we have taken note of the request. We will update you about the progress once it is prioritized and taken up.

    Thanks

    Vishwa



    ------------------------------
    Hosathota Vishwanatha
    ------------------------------



  • 13.  RE: Net.IBM.Data.Db2-osx not working

    Posted 29 days ago

    hello
    I am from M1 and I am using the package IBM. EntityFrameworkCore osx. Currently, I have similar errors as him:

     System.IO.FileNotFoundException: Could not load file or assembly 'IBM.EntityFrameworkCore, Version=8.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208'. The system cannot find the file specified.
     
          File name: 'IBM.EntityFrameworkCore, Version=8.0.0.200, Culture=neutral, PublicKeyToken=7c307b91aa13d208'
             at Program.<>c__DisplayClass0_0.<<Main>$>b__0(DbContextOptionsBuilder options)
             at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass1_0`2.<AddDbContext>b__0(IServiceProvider _, DbContextOptionsBuilder b)
             at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
             at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass17_0`1.<AddCoreServices>b__0(IServiceProvider p)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
             at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
             at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
             at lambda_method2(Closure, IServiceProvider, Object[])
             at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
          --- End of stack trace from previous location ---
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
          --- End of stack trace from previous location ---
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
             at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
             at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
             at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
             at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
    Looking forward to your reply, thank you


    ------------------------------
    qin zhaofan
    ------------------------------