Search code examples
openedgeprogress-4glprogress-db

Progress DB 4GL - prevent too many connections with the same connect-name or ip-address


How to prevent too many connections with the same username or ip adress? is there any database, startup parameter in 4GL?

Sometimes we have a network error or a client error where many connections are started in a few seconds and the databases are overflowing and new connections can no longer be started

Thanks!


Solution

  • There are no startup parameters or other configuration options that will restrict connections in this manner.

    To implement such restrictions you would need to add code to your connection startup (login) procedure. For interactive clients that is the procedure specified with the -p startup parameter. You can see the userid and ip address of other connections by querying the _CONNECT virtual system table. Something like this will give you the information that you need:

    define variable myName    as character no-undo format "x(30)".
    define variable myDevice  as character no-undo format "x(30)".
    
    define variable myLogins  as integer no-undo.
    define variable myFriends as integer no-undo.
    
    find _myConnection no-lock.
    
    find _connect no-lock where _connect-id = _myconn-userid + 1.
    assign
      myName   = _connect-name
      myDevice = _connect-device
    .
    
    for each _connect no-lock where _connect-usr <> ?:
    
      if _connect-name = myName then myLogins = myLogins + 1.
      if _connect-device = myDevice then myFriends = myFriends + 1.
    
    end.
    
    display
      myName myLogins skip
      myDevice myFriends skip
     with
      side-labels
    .
    

    Replace the DISPLAY with some logic to respect whatever limits you want to impose and, if those limits are exceeded, QUIT the session.