Global Data Management Forum

 View Only
  • 1.  .NET 6 Linux based Docker application - licensing issue

    Posted Mon October 17, 2022 07:06 AM
    Hello IBM community,
    I try to dockerize an application currently running on dotnet 6 Windows. it run good.
    I have read the blog post of Hosathota Vishwanatha here and make my own dockerfile to build & run this app on linux.

    here the dockerfile :

    FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
    WORKDIR /src
    COPY ["MyApp.csproj", "."]
    RUN dotnet restore "./MyApp.csproj"
    COPY license/db2consv_ee.lic /root/.nuget/packages/net.ibm.data.db2-lnx/6.0.0.300/buildTransitive/clidriver/license
    COPY . .
    WORKDIR /src
    RUN dotnet build "MyApp.csproj" -a x64 -c Debug -o /app/build
    RUN dotnet publish "MyApp.csproj" -a x64 -c Debug -o /app/publish
    
    FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
    WORKDIR /app
    COPY --from=build /app/publish .
    
    RUN apt-get -y update && apt-get install -y libxml2
    
    ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \
    DOTNET_RUNNING_IN_CONTAINER="1" \
    ASPNETCORE_URLS="http://+:9183" \
    PATH=$PATH:"/app/clidriver/bin" \
    LD_LIBRARY_PATH="/app/clidriver/lib:/app/clidriver/lib/icc" \
    DB2_CLI_DRIVER_INSTALL_PATH="/app/clidriver" \
    DYLD_LIBRARY_PATH="/app/clidriver/lib" \
    LIBPATH="/app/clidriver/lib"
    
    EXPOSE 9183
    
    ENTRYPOINT ["dotnet", "MyApp.dll"]

    here my sample source code :

    using DB2Connection objConnection = new DB2Connection("Server=IP:446;database=MyDataBase;UID=MyUID;PWD=MyPwd;Connect Timeout=2");
    objConnection.Open();
    using DB2Command cmd = objConnection.CreateCommand();
    cmd.CommandText = "SELECT * FROM MYTABLE;";
    cmd.CommandTimeout = 10;
    cmd.CommandType = CommandType.Text;
    
    using DB2DataReader reader = (DB2DataReader)await cmd.ExecuteReaderAsync();
    
    if (reader != null && await reader.ReadAsync())
    {
    
    // ...

    It fails with "ERROR [42968] [IBM] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968"
    My licence file db2consv_ee.lic work well in windows.
    I check the licence in the container in clidriver/license directory after the build and it is here.
    I use the same version of dotnet driver (Net.IBM.Data.Db2[-lnx] 6.0.0.300)

    Did i do something wrong ?

    Thanks





    ------------------------------
    thomas le magourou
    ------------------------------

    #DataManagementGlobal
    #DataServerDrivers


  • 2.  RE: .NET 6 Linux based Docker application - licensing issue

    Posted Tue October 18, 2022 04:59 AM
    Hi Thomas,
     the steps mentioned looks good and I do not see any issue either in the docker file or code above. Can you please contact IBM tech support for further assistance on this and share the traces for this scenario?

    Please follow the instructions in the below link for capturing the traces.

    https://community.ibm.com/community/user/hybriddatamanagement/blogs/naveenkumar-n-l/2021/07/27/steps-to-create-traces-for-different-db2-net-provi

    Thanks
    Vishwa

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



  • 3.  RE: .NET 6 Linux based Docker application - licensing issue

    Posted Tue October 18, 2022 06:16 AM

    There is lots of traces.
    From cli trace i see an error : 

    SQLAllocHandle( fHandleType=SQL_HANDLE_DBC, hInput=0:1, phOutput=0:1 )
    2581    <--- SQL_SUCCESS   Time elapsed - -8.081421E+008 seconds
    
    2736	SQLDriverConnectW( hDbc=0:1, hwnd=0:0, szConnStrIn="protocol=tcpip;hostname=*****;port=446;database=******;ConnectTimeout=2;uid=*********;pwd=*********;", cbConnStrIn=106, szConnStrOut=<NULL pointer>, cbConnStrOutMax=0, pcbConnStrOut=<NULL pointer>, fDriverCompletion=SQL_DRIVER_NOPROMPT )
        ---> Time elapsed - -8.081421E+008 seconds
    
    SQLDriverConnectW( )
    17680    <--- SQL_ERROR   Time elapsed - -8.081421E+008 seconds
    ( iRowNumber=-1, iColumnNumber=-2 )
    
    18082	SQLFreeHandle( fHandleType=SQL_HANDLE_DBC, hHandle=0:1 )
        ---> Time elapsed - -8.081421E+008 seconds
    ( Number of allocations left before we freed the Pool=2 )
    
    SQLFreeHandle( )
    18305    <--- SQL_SUCCESS   Time elapsed - -8.081421E+008 seconds
    


    From flow traces :

     7675       | | | | SQLDriverConnect2 exit [rc = 0xFFFFFFFF = -1]
    17676       | | | | CLI_DstReleaseHLatch entry
    17677       | | | | | sqloxult_app entry
    17678       | | | | | sqloxult_app exit
    17679       | | | | CLI_DstReleaseHLatch exit
    17680       | | | SQLDriverConnectW exit [rc = 0xFFFFFFFF = -1]
    17681       | SQLConnectADONET error [probe 50]
    17682       | | | sqlofmblkEx entry
    17683       | | | sqlofmblkEx mbt [Marker:PD_OSS_FREED_MEMORY ]
    17684       | | | | sqlofmblkExTrace entry
    17685       | | | | sqlofmblkExTrace mbt [Marker:PD_SQLOMEM_TRACE_BLOCK_FREE ]
    17686       | | | | sqlofmblkExTrace exit
    17687       | | | sqlofmblkEx exit
    17688       | SQLConnectADONET exit [rc = 0xFFFFFFFF = -1]
    17689       | DB2Trace.TraceVersion data [probe 10]
    17690       | DB2Trace.TraceVersion data [probe 11]


    And I see many RC_ENV_INV_PARM and RC_ENV_NOT_FOUND

    From fmt traces :

    17678	exit DB2 UDB Client-side (app) latches sqloxult_app fnc (2.3.179.5.0)
    	pid 1 tid 140625594308352 cpid -1 node -1
    	rc = 0
    
    17679	exit DB2 UDB call level interface CLI_DstReleaseHLatch fnc (2.3.42.346.0)
    	pid 1 tid 140625594308352 cpid -1 node -1
    	rc = 0
    
    17680	exit DB2 UDB call level interface SQLDriverConnectW api (2.3.42.527.3)
    	pid 1 tid 140625594308352 cpid -1 node -1
    	rc = 0xFFFFFFFF = -1
    	bytes 10
    
    	Data1 	(PD_CLI_TYPE_SQLRETURN,2) SQL Return Code:
    	SQL_ERROR
    	Hex:
    	FFFF                                       ..
    
    
    17681	error DB2 UDB call level interface SQLConnectADONET fnc (4.3.42.826.0.50)
    	pid 1 tid 140625594308352 cpid -1 node -1 probe 50
    	Error ZRC = 0x00000000 = 0 = HA_ZRC_OK
    	bytes 10
    
    	Data1 	(PD_TYPE_DEFAULT,2) Hexdump:
    	FFFF                                       ..
    
    
    17682	entry DB2 UDB SQO Memory Management sqlofmblkEx cei (1.3.129.33.2)
    	pid 1 tid 140625594308352 cpid -1 node -1
    
    	bytes 51
    
    	Data1 	(PD_TYPE_PTR,8) Pointer:
    	0x00007fe5f011d1c0
    	Data2 	(PD_TYPE_OSS_MEM_FILE_NAME,11) File name:
    	cliadonet.C
    	Data3 	(PD_TYPE_OSS_MEM_LINE_NUM,8) Line of code:
    	1113

    Do you need other trace ? or are there any specific terms to search ?



    ------------------------------
    thomas le magourou
    ------------------------------



  • 4.  RE: .NET 6 Linux based Docker application - licensing issue

    Posted Wed October 19, 2022 02:09 AM
    Hi Thomas,
     thanks for the additional information but it looks similar to what was in error message. For us to analyze it further, please open case with IBM tech support and please share the traces you captured.

    Thanks 
    Vishwa

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



  • 5.  RE: .NET 6 Linux based Docker application - licensing issue

    Posted Thu October 20, 2022 04:17 AM
    Good news !
    I found the bug, IBM support point that licence file is in incorrect format and i found that my file contains Carriage Return (CR) character. That is an Windows Line return character (CR LF) in linux it must be only LF.
    That work fine by replacing CR LF by LF in license file.

    Regards

    ------------------------------
    thomas le magourou
    ------------------------------