DB Release Step - When?

Version 1
    This document was generated from CDN thread

    Created by: J Daniel Salamanca on 02-03-2012 06:01:43 AM
    Hello,
    I am just starting making scipts for the UCCX, and I have seen some examples previously done by other guys, and I see that after the DB Read step, on the "Connection not available" branch and "SQL error" branch they always put the DB release step before continuing.
     
    On the other hand, I checked the UCCX scripting guide and it's written there that you should use it after the DB get or DB write steps to release resources.
     
    Can anybody tell me if it's really necessary to use it after reading the DB or just after getting information or writting?
    Thank you in advance!
     
    Daniel

    Subject: RE: DB Release Step - When?
    Replied by: jonathan baldwin on 02-03-2012 07:55:15 AM
    Im pretty sure its in the best practice to have a release step after any read or get. If you left the connection open and the caller terminated the call you would have an open connection left.

    /Jon

    Subject: RE: DB Release Step - When?
    Replied by: Steven Pawlak on 02-03-2012 10:40:12 AM
    Daniel,

    I concur with Jon.

    You WANT to close all DB connections as soon as you can. This is standard best practice in all programming environments.

    I usually put the Close after the Read or Write step and not on the branches. I also put the Get step on the Successful branch of the Read step. Then do nothing else in that branch. The code then moves on to the Close step and then I do stuff with the data from the Get step.


    They are external connections that limited in count and heavy in resource utilization. The Database SubSystem on CCX will try and work on a pool, but if you do not close then they sit open way to long until the system times out. If you have a pool of 10 allowed and have 15 calls come in over a short time, then the extra five calls will have to wait or will fail since they cannot get a DB connection.

    Subject: RE: DB Release Step - When?
    Replied by: jonathan baldwin on 02-03-2012 10:56:37 AM
    Daniel,

    I concur with Jon.

    You WANT to close all DB connections as soon as you can. This is standard best practice in all programming environments.

    I usually put the Close after the Read or Write step and not on the branches. I also put the Get step on the Successful branch of the Read step. Then do nothing else in that branch. The code then moves on to the Close step and then I do stuff with the data from the Get step.


    They are external connections that limited in count and heavy in resource utilization. The Database SubSystem on CCX will try and work on a pool, but if you do not close then they sit open way to long until the system times out. If you have a pool of 10 allowed and have 15 calls come in over a short time, then the extra five calls will have to wait or will fail since they cannot get a DB connection.


    Yeah thats exactly what i do too. DBGET is on the success of DBREAD and all options include a DBRELEASE. any DBWRITES are added later on.
     
    /J

    Subject: RE: DB Release Step - When?
    Replied by: J Daniel Salamanca on 05-03-2012 04:52:24 AM
    Hello everybody.
    Ok, then I will put the release step after reading as well.

    Thank you very much for all your answers!