Db2

Db2

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
  • 1.  Slow first connection to db2 in c#

    Posted Wed May 14, 2025 12:20 PM

    because the first connection to db2 took more than 10, 20 at 30 seconds.
    I am doing a proof of concept because my system takes a long time to connect to the database with my .net code and the IBM.Data.Db2 library (version 7.0.0.400) I need to know if I should configure something additional or at source code level.

    take as reference this code with the following link
    https://www.ibm.com/docs/es/db2w-as-a-service?topic=programmatically-net

    connection string is: Database=XXXXX;Server=100.100.100.100:446;UID=XXXXX;PWD=XXXX

    attached evidence



    ------------------------------
    Marco Ayala
    ------------------------------


  • 2.  RE: Slow first connection to db2 in c#

    Posted Wed May 14, 2025 05:31 PM
    Has the database in question been activated (assuming this is LUW) ?





  • 3.  RE: Slow first connection to db2 in c#

    Posted Wed May 14, 2025 05:50 PM
    Edited by Jan Nelken Wed May 14, 2025 05:51 PM

    Hi Philip,

    Since original poster provided us with entertainment of multiple posts for the same topic, you will find in another post from the same author, that database server is AS400. My first thought was lack of activation, but I don't know anything about AS400 to advise further.



    ------------------------------
    Jan Nelken
    Db2 (LUW) DBA
    Open for job
    Katowice or Krakow
    +48 783 109 863
    ------------------------------



  • 4.  RE: Slow first connection to db2 in c#

    Posted Thu May 15, 2025 03:43 AM

    This is a classic case of the database not being active before and the first connection spending time to implicitly activate the database. Please work with your DBA to explicitly activate the database. If you don't have a DBA, please encourage your org to hire an actual DBA to handle these.



    ------------------------------
    Bujji Phanikiran Vanjarapu
    ------------------------------



  • 5.  RE: Slow first connection to db2 in c#

    Posted Thu May 15, 2025 05:58 AM

    Hi Marco,

    As an experiment - could you perform a "dummy" connection to Db2/400 from the same client machine - outside of your C# application - something like:

    connect to database
    connect reset

    prior to starting your main test and report timings?



    ------------------------------
    Jan Nelken
    Db2 (LUW) DBA
    Open for job
    Katowice or Krakow
    +48 783 109 863
    ------------------------------