Re: How to change DB connection in Forms v4.5?

From: Miodrag Stojanovic <miodrag_stojanovic_at_oma.org>
Date: 1997/09/15
Message-ID: <341D5661.FF648044_at_oma.org>#1/1


Hi,

this is easy. Create list item for your database (:B_CONTROL.DATABASE) where the (description, value) pairs, where description is what you see on screen (e. g. Development, Testing, Production,...) and value is name of the instance (e. g. DEV, TEST, PROD,...). For example create push button :B_CONTROL.CONNECT with label Connect and create trigger WHEN-BUTTON-PRESSED. In your trigger write following code:

Case 1:
If user names and passwords are same for all databases:

     logout;
     logon(get_application_property(USERNAME),

get_application_property(PASSWORD)||'_at_'||:B_CONTROL.DATABASE, FALSE);

Case 2:
If user names and passwords are not same for all databases, create two items: B_CONTROL.USERNAME and B_CONTROL.PASSWORD where you are going to enter information about user name and password.

     logout;
     logon(:B_CONTROL.USERNAME,
              :B_CONTROL.PASSWORD||'_at_'||:B_CONTROL.DATABASE, FALSE);


This will get you connected to the different database. If you instance names and descriptions exist in a table, item :B_CONTROL.DATABASE could be populated programmatically. This is not a bad idea, 'cos some users have access to all databases, but others only to one or two.

Play around and have fun.

Regards
Miodrag

Darren Darnell wrote:

> We are trying to write an application to add users to our various
> databases using Forms v4.5. We want to be able to select the
> databases
> from a list, and have the application add the user to the selected
> databases.
>
> We don't know how to close our current DB connection, and open another
>
> with different connect string.
>
> Thanks in advance.
> --
> #####################################################################
> # #
> # These are my opinions, and not those of my employer. #
> # #
> # Darren Darnell Database Systems Team #
> # darren.darnell_at_edwardjones.com Edward Jones #
> #####################################################################
Received on Mon Sep 15 1997 - 00:00:00 CEST

Original text of this message