Db2

 View Only
Expand all | Collapse all

How to use DB2Connect license file for IBM Db2 .net provider nuget package?

  • 1.  How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Tue March 07, 2023 03:22 AM
    Edited by Siva Sankaran Tue March 07, 2023 03:27 AM

    My workstation machine and our app servers(both prod & QA environments) are all got folders C:\Program Files\IBM\SQLLIB\ . It contains DB2 .net providers for older .net framework(C:\Program Files\IBM\SQLLIB\BIN\netf40_32). Our few old applications are using IBM DB2 ODBC Driver. But for application we can't use that since we can't find a working connection string which uses SSL Certificates as Authentication instead of password.

    Now we have added NuGet Gallery | IBM.Data.DB2.Core 3.1.0.600 in our .net core application. During development and QA deployment, our app is working fine by connecting with Db2 (Does that mean we have license in place and no need to worry?). Now we are going to deploy to production server.  I am worrying about whether we will face any issue due to license. 

    I learned that "existing DB2Connect license should work" from this faq. How to find whether we have DB2Connect license or not? This blog post says we need to place the license file in the specified path.

    Currently I can find 2 files named "odbc_notices.rtf" , "odbc_REDIST.txt"  in C:\Users\ {MyUserName} .nuget\packages\ibm.data.db2.core\3.1.0.600\buildTransitive\clidriver\license folder along with another folder named "Windows" which contains odbc_LI_en.rtf file. And also I can only find rtf files in this folder C:\Program Files\IBM\SQLLIB\license . 

    I want to ensure that our production deployment will connect with Db2 using IBM Db2 .NET Core Provider without any issue.

    My questions are:

    1. How to verify whether my app servers have "Db2Connect" or not? I geuss we have DB2Connect as we have files in C:\Program Files\IBM\SQLLIB\. But  we need a way to confirm this
    2. If yes, From where(license file path location) we can copy the license file?
      • How to identify a license file ? what is the file extension?
      • For local dev, To which location we need to paste the license file whether "C:\Users<MyUserName>.nuget\packages\ibm.data.db2.core\3.1.0.600\buildTransitive\clidriver\license" or C:\Users<MyUserName>\sourceCode\ApplicationProject\bin\Debug\netcoreapp3.1\clidriver
      • For QA , Prod environment server deployment To which location we need to place the license file whether E:\apps\MyApplication\clidriver\license or "C:\Users<MyUserName>.nuget\packages\ibm.data.db2.core\3.1.0.600\buildTransitive\clidriver\license"
    3. Do we need license to use IBM .net provider dll in C:\Program Files\IBM\SQLLIB\BIN\netf40_32 ?



    ------------------------------
    Siva Sankaran
    ------------------------------



  • 2.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Mon March 20, 2023 09:27 AM

    Hello Siva,

    I am also trying to use IBM.Data.DB2.Core nuget package to connect to DB2 database from .Net Core 3.1 api. When I install the nuget packages, I couldn't see the license file in "C:\Users\<username>\.nuget\packages\ibm.data.db2.core\3.1.0.600\buildTransitive\clidriver\license" folder and not sure how/where to fetch the license file. Due to license file missing, am getting the error message "ERROR [42968] [IBM] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968" while opening the connection.

    Please let me know if you find any solution.



    ------------------------------
    Anand Anbalagan
    ------------------------------



  • 3.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Thu March 23, 2023 03:06 AM

    Hi @Anand Anbalagan  , I think this thread might help you .NET Core Licensing problem | Global Data Management Forum (ibm.com). In this thread Viswa is telling some details.

       As far as now we haven't faced any issue like what you mentioned. So, I guess my employer might already bought the license. I am not sure. I want to confirm this.  



    ------------------------------
    Siva Sankaran
    ------------------------------



  • 4.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Sun March 26, 2023 11:44 PM

    Hi Anand,

     please send us a message through NuGet and we would share the details to get the trial license. 

    Thanks and regards

    Vishwa



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



  • 5.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Fri October 06, 2023 10:52 AM

    Hi, my apologies for reviving this old thread. We're new to the IBM .NET provider and we understand we need a license. We did not know we could get a trial license. This would be ideal, so we can test our design assumptions. How can we get a trial license? I see you wrote "send us a message through NuGet" but I don't see how to do that. Again my apologies.

    Regards

    Furio Filoseta



    ------------------------------
    Furio Filoseta
    ------------------------------



  • 6.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Mon October 09, 2023 01:10 AM

    Hi Furio,

     On NuGet.org (https://www.nuget.org/packages/Net.IBM.Data.Db2/) there is an option "Contact owners -> " towards right side of the screen. You can use that option to send us a note about your requirement and we will respond.

    Thanks

    Vishwa



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



  • 7.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Mon December 18, 2023 06:51 PM

    I cannot seem to be able to use the Contact owners link as you have recommended.  How can I get a trial license to do a POC for my company (a VERY large iSeries customer).  I have written a C# .Net 7 Web API that will just do Get on QIWS/QCUSTCDT to prove that we can connect to the iSeries using 

        <PackageReference Include="Net.IBM.Data.Db2" Version="7.0.0.200" />
        <PackageReference Include="IBM.EntityFrameworkCore" Version="7.0.0.200" />
    I am currently getting 
    IBM.Data.Db2.DB2Exception (0x80004005): ERROR [42968] [IBM] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968  when I do this in my Controller 
            var customerList = await _context.QCUSTCDTItems.Take(20).OrderByDescending(o => o.CUSNUM).ToListAsync();


    ------------------------------
    Richard Rothe
    ------------------------------



  • 8.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    IBM Champion
    Posted Mon December 18, 2023 10:26 PM

    IBM Db2 Connect is a licensed product that enables connectivity to Db2 databases. If you have a Db2 Connect license and you want to use the IBM Db2 .NET provider (IBM.Data.DB2) with a NuGet package, you can follow these steps to configure the license file:

    1. Acquire the Db2 Connect License File: Ensure that you have a valid Db2 Connect license file. This file typically has a ".lic" extension.

    2. Place the License File: Place the Db2 Connect license file in a location where your application can access it. You might want to put it in the same directory as your application executable or in a centralized directory.

    3. Set the License File Path in Code: In your .NET application code, set the license file path before establishing a connection to the Db2 database. You can do this by using the DB2.License property. Here's an example in C#:

    using IBM.Data.DB2;

    class Program
    {
        static void Main()
        {
            // Set the path to the Db2 Connect license file
            DB2.License = "C:\\Path\\To\\Your\\LicenseFile.lic";

            // Now, you can establish a connection to the Db2 database
            string connectionString = "Database=YourDbName;UserID=YourUserId;Password=YourPassword;Server=YourDbServer;";
            using (var connection = new DB2Connection(connectionString))
            {
                connection.Open();
                // Perform database operations here
            }
        }
    }

    1. Replace "C:\\Path\\To\\Your\\LicenseFile.lic" with the actual path to your Db2 Connect license file.

    2. Deploy Your Application: Ensure that the Db2 Connect license file is deployed along with your application when you distribute it.

    3. Check Connection: Verify that your application can connect to the Db2 database without any licensing issues.

    By setting the DB2.License property in your code, you explicitly specify the location of the Db2 Connect license file that the IBM Db2 .NET provider should use.

    Remember that adhering to licensing agreements is crucial, and you should ensure that you have the right to distribute and use the Db2 Connect license in your application. If you encounter any issues or have specific questions about licensing.



    ------------------------------
    Sarwar Javaid
    Sr. Systems Engineer | Information Technology
    Dollar Industries Pvt. Ltd. | D-85, S.I.T.E Area, Karachi
    Cell: (+92) 346 2595970
    ------------------------------



  • 9.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?
    Best Answer

    Posted Fri March 24, 2023 01:54 PM

    Db2 Connect basically is the the license.  The rest is just the IBM Data Server Client/Driver.
    The license may have been already installed on the Db2 mainframe system, that way it is not needed on the client side.  
    If the license is not on the Db2 mainframe system it needs to be installed on the client, it is not enough to have a file, try to run "db2licm -l" to see if there is a license on the test and QA machines.
    You can run "db2cli validate" with different options to check the connections, license etc.  



    ------------------------------
    Tommy Petersen
    ------------------------------



  • 10.  RE: How to use DB2Connect license file for IBM Db2 .net provider nuget package?

    Posted Fri April 07, 2023 03:42 AM

    Thank you @Tommy Petersen  . So our database server should have this Db2 Connect license. Now I can understand that We don't need to do anything for license. I can be in peace now. 



    ------------------------------
    Siva Sankaran
    ------------------------------