Uniface User Forum

 View Only
  • 1.  Is there a way check if a path is already open?

    PARTNER
    Posted 04-13-2023 06:24

    Hi all,

    A question that brings me back to my first Uniface experience and the miraculous way Uniface opened a path to the database, both explicitly (with the open statement) and implicitly (as soon as needed with info from the asn). But what if we are not sure about the status of the connection to a path? Is there a way to find out if the path is opened already?

    What I have tried so far:

    1. Do some IO to the database. Unfortunately this activates the credentials popup. We don't want that to happen.
    2. Use $user and/or $password. These will only have a value if the path credentials are available. Unfortunately they seems to crash Uniface is the path not opened yet.
    3. Just do an 'open' statement. This is how it's done most of the times. The open statement does an implicit close of the path if it was already open. 

    I wished there was a function to return the status of a path. Or is there such?



    ------------------------------
    Peter Lammersma
    Coöperatie Unividuals Application Management
    Amsterdam NL
    ------------------------------


  • 2.  RE: Is there a way check if a path is already open?

    Posted 04-15-2023 15:34
    Edited by Knut Dybendahl 04-15-2023 15:34

    Hey Peter,

    Our db connection times out (from the db side) after 30 minutes.
    I'm using a
    sql/data "select sysdate from dual","$DEF"  from our three main activation routines - in other words -
    the connection(s) were established at logon - then they might 'die' whilst the user is busy doing 
    non-db work.
    The usysidx does NOT pop - I simply get a $status < 0 - thus I know the connection is dead...

    Hope this helps.
    Knut



    ------------------------------
    Knut Dybendahl
    ------------------------------



  • 3.  RE: Is there a way check if a path is already open?

    PARTNER
    Posted 04-17-2023 07:42

    Hi Knut,

    Thanks for your answer. We are experiencing disconnections to the database caused not so much by timeouts, but by minor disruptions in the network. As a result, the connection is broken but Uniface thinks the connection is still there.

    We use a sql query, just like yours, to check if there still is a connection. If that returns a negative $status, we use the open statement to open the path to the database again.
    Unfortunately, sometimes Uniface shows the path credentials popup when the sql statement is executed. 
    If we then try to skip the sql and go for the open statement, Uniface crashes.

    Maybe someting for the Uniface wishlist.



    ------------------------------
    Peter Lammersma
    Coöperatie Unividuals Application Management
    Amsterdam NL
    ------------------------------



  • 4.  RE: Is there a way check if a path is already open?

    Posted 04-17-2023 12:28

    Ciao Peter,

    we use technique #3.

    About your point #2:
    I made a quick check in our production environment where the logon (to Oracle) is happening in a later stage when user access first real data. 
    When path is not yet open I did not experienced any crash!
    Either $user(DEF) or $user(ORA) and $password(DEF) or $password(ORA) are nicely giving me back what is configured into our scrambled ASN.
    How you were able to have Uniface runtime to crash?

    Best regards,
    Gianni



    ------------------------------
    Gianni Sandigliano
    IT
    ------------------------------



  • 5.  RE: Is there a way check if a path is already open?

    PARTNER
    Posted 04-18-2023 07:51

    Hi Gianni,

    $user and $password return the user and password that are/were used to open the path to the database. Regardless if they come from the path in the assignment file or specified in the open statement. That is really very useful. 
    The problem occurs when the username or password are not specified in the asn, since we use a user dependent username and password to access the database. That means that without a path being opened once $user and $password don't have a value. In these circumstances I want to be able to check if there is a path opened to the database (without doing any i/o yet, since i/o without a opened path will show the credentials popup), because when I do the open statement with the $user and $password Uniface won't like it.
    That reminds me, I remember from a project a long time ago ( everything is :) ) we overruled the credentials popup. Must have been in Seven.

    Regards, Peter



    ------------------------------
    Peter Lammersma
    Coöperatie Unividuals Application Management
    Amsterdam NL
    ------------------------------



  • 6.  RE: Is there a way check if a path is already open?

    Posted 04-18-2023 16:13

    Hi Peter,

    Surely - when the user has successfully logged in - set a session variable and/or a global?
    Then you're sure the path has at least been opened.
    If the variables has been set - do a dummy select.
    No?

    Regards,
    Knut



    ------------------------------
    Knut Dybendahl
    ------------------------------



  • 7.  RE: Is there a way check if a path is already open?

    PARTNER
    Posted 04-20-2023 03:28

    Hi Knut,

    Yes, that's the way we try to solve this issue. Setting a global variable as soon as the path is opened. 

    Still remains my wish to have such in available in the Uniface code set. 
    By the way,  the wishlist itself is on the wishlist.... :)

    Thanks Knut and Gianni for your input. It is appreciated.

    Regards, Peter



    ------------------------------
    Peter Lammersma
    Coöperatie Unividuals Application Management
    Amsterdam NL
    ------------------------------