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 Fri May 17, 2024 09:48 AM

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



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

    Posted Thu January 02, 2025 05:41 AM


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



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

    Posted Thu January 30, 2025 02:44 PM

    Thank you. The new version is working as expected.



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



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

    Posted 21 days ago

    Hi,

    I have this error : ERROR [42968] [IBM] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968

    I work on a Mac OS M2 ARM and My 'db2consv_ee.lic' license hasn't worked since I switched to Mac OS. (I used to work on Windows before)

    My project is in dotnet 9 and I use the package <PackageReference Include="Net.IBM.Data.Db2-osx" Version="9.0.0.100" />

    I filed the license in this folder : /Users/MyUser/.nuget/packages/net.ibm.data.db2-osx/9.0.0.100/buildTransitive/clidriver/license/

    when I build and run my app the license is copied into the folder : /bin/Debug/net9.0/clidriver/license

    I don't understand why I have this error because my license works on my other environments, Do you have any idea to solve my problem ?

    Thank you in advance for your help.



    ------------------------------
    Clément Savy
    ------------------------------



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

    Posted 20 days ago

    Hi Clément Savy

    For .NET9 (9.0.0.100) package you need to use 12.1 license file.

    Thanks

    Naveen



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



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

    Posted 20 days ago

    Hi Naveenkumar N L 

    Thank you for your quick response.

    Do you have documentation that lists the license versions compatible with the  .NET9 (9.0.0.100) package ?

    Where can I find the version number of my license?

    In my license file I see 'ProductVersion=11.5'. does this mean my license version is 11.5 ?

    Thank you in advance for your answers.



    ------------------------------
    Clément Savy
    ------------------------------



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

    Posted 19 days ago

    Hi Clément Savy

    Yes. The ProductVersion is the license version. For more details you can go through this blog

    Thanks 

    Naveen



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



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

    Posted 13 days ago

    Hello,

    sorry for asking, since I am new to db2, to use this package for .net 9, where can I find the license file? I want to use this package with our as400 database.

    thanks



    ------------------------------
    webster velasco
    ------------------------------



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

    Posted 12 days ago

    For this you will need DB2 Connect.  The product will have the db2lic file that can be installed either of the host server or remotely.  Go for the host install so you don't have ship it to remote clients, but that may be dependent on what framework you rap around your . Net code.  



    ------------------------------
    Douglas Partch
    CEO
    Database Nerds
    Omaha NE
    ------------------------------