database disconnection problems

jke

New Member
Hello,

I've got the following problem.

I've got a procedure that connects and disconnects databases required to compile files.
I've got a procedure that compiles files.

I run these as follows (more or less):

Code:
for each ttfile no-lock:
  run connectdbsforfile.p (ttfile.filepath).
  run compilefile.p (ttfile.filepath).
end.



The problem: When a disconnect is used in conectdbsforfile it has no effect. The compilefile procedure gives errors because the databases disconnected in the connectdbsforfile.p procedure are still connected. Has anyone got an explanation and/or sollution for this problem? There are no transactions or anything else on the databases. The only thing we do is compile files that use the databases that have been connected. We do not run any procedure that requires the databases.

Kind regards,

Jan
 
I'm not exactly sure what the standard Progress behaviour is, but in my experience if you connect to a database then run another program, then disconnect and connect to another database then if the program you ran before is still cached then it will keep the same database settings.

What I do in the same situation is to disconnect all the databases during each loop, but in the second called program.

So, I would disconnect all the databases in compilefile.p and reconnect the required ones in connectdbsforfile.p. I'd also put a check in compilefile.p to ensure that the right databases are connected (use connected and the physical database name, unless you have more than one database with the same physical name).

def var i as int. do i = 1 to num-dbs: disconnect value (ldbname (i)). end.

I think there is a startup option that forces Progress to load up each program from scratch, but I can't remember what it is.
 
Hi.

I don't know connectdbsforfile.p source.

Try this:

Code:
[FONT=Courier New]FOR EACH .....
  CONNECT VALUE(ConnectParam) NO-ERROR.
  IF NOT CONNECTED(DbName)
     THEN DO:
            MESSAGE "Connection Error" VIEW-AS ALERT-BOX ERROR.
            NEXT.
          END.
     ELSE RUN compilefile.p (input ...).
  DISCONNECT VALUE(DbName).
END.[/FONT]

 
Back
Top