[SOLVED] Changing databases programmatically

Author: ablancouribe@compuamerica.com.ve (bioalexy)

Hi I'm developing an application with the same data model but I need to use different DBs per country, how can I change the conexion between DBs in a form when I select a country. I tried the "open" statement but it didn't work, I don't know if there is a problem with my path configuration (.asn)  Regards.

6 Comments

  1. Hi, what does it mean that "open statement does not work"? We use similar scenario in our application... in the very first form use can choose the DB to log in and in the VALC trigger of the DropDownList we just open another connection. The return status of your open statement might help a lot. :-) Zdenek


    Author: sochaz (zdenek.socha@fullsys.cz)
  2. The "open" return 0, but the application keeps using the same DB, that´s why I think I need to change something in my configuration. Also it is possible to change DB even if im not in the first form?


    Author: bioalexy (ablancouribe@compuamerica.com.ve)
  3. Hello, if the path is already open by your asn file (ie: $DEF = ORA:database|user|password), you can't reopen it with other options. To be able to reopen a path during a session ,it must be incomplete in asn file (ie: $DEF = ORA:?|?|?) and open once in beginning of the startup shell and reopen after with your options.


    Author: Philippe (philippe.grangeray@agfa.com)
  4. are you closing the old path?  Have you looked at the SQL in the msg frame to see what the driver is actually doing? That will give you some pointers on what is happening. 


    Author: Adrian Gosbell (adrian.gosbell@synapse-i.jp)
  5. According to the documentation - an 'open' statement on an already existing open path will cause an implicit close before the path is (re)opened. However, afaik, you can only switch databases if your ASN file has the ? used after the database name in the path specification. If the username is the same, you can leave those as is - if the username / passwords are different, use ?|?|?. If you're trying this from a PC - USYSIDX should pop up - enabling you to enter the parameter where the question mark is specified. Regards, Knut


    Author: Knut (knut.dybendahl@gmail.com)
  6. Thanks for the help, I changed the path in the ASN file to ?|?|? and was able to change to the other DBs


    Author: bioalexy (ablancouribe@compuamerica.com.ve)