Re: Changing the database at runtime
Posted in 1996
Mike is basically correct. But you do need source! and the database defined at the beginning of the MAIN module MUST exist. Otherwise you get a -329 Database not found or no system permission error. Another possible easier mechanism, which would only work with SE would be to have the two databases with the same name in different paths and use DBPATH to swap between them. With OnLine version 5 you could get the same effect by having two separate instances and choose between them using TBCONFIG. > Its easy in 4gl, > You still need a "database dbname" at the top - so pick one. > Then in the main section you could have something like > > let w_dbname=fgl_getenv("DBNAME") > let w_prepstr="database ",w_dbname > prepare p_id1 from w_prepstr > execute p_id1 > > all you need to do to change databases is to issue another > "database dbname"! > > (Make sure you dont have any cursors or transactions open or anything > like that. I have had some trouble in the past with that type of thing!) > > > > -- > Mike Aubury _\\?/_ > |O O| > +----------oOOO-\\_/-OOOo---------+-----------------------------+ > | Heisenberg may have been here | mike@aubury.demon.co.uk | > +--------------------------------+-----------------------------+ > Malcolm Weallans Online Database Consultancy Phone 01628-72154 Fax 01628-37463 CIX - onlinedbc