Connecting to database [message #129146] |
Fri, 22 July 2005 03:11 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
darsh_v
Messages: 16 Registered: February 2005 Location: hyderabad
|
Junior Member |
|
|
How can we programatically connect to a database in forms. I tried using the following two commands:
EXEC_SQL.Open_Connection
connect db
can anyone tell me the exact usage of these
|
|
|
Re: Connecting to database [message #129300 is a reply to message #129146] |
Sat, 23 July 2005 08:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
oraclejo
Messages: 50 Registered: July 2005 Location: Ammar
|
Member |
|
|
this example shows how one can override the Forms logon processing by creating a form trigger called On-logon
When the form is run, the original logon while not take place rather the On-logon code shown below will execute
Note that the Login Built-in function connects to the Oracle database.
On-Logon (Form Level)
DECLARE
un VARCHAR2(30);
pw VARCHAR2(30);
cs VARCHAR2(30);
upc VARCHAR2(200);
connected BOOLEAN := FALSE;
tries NUMBER := 3;
PROCEDURE get_connect_info IS
BEGIN
un := GET_APPLICATION_PROPERTY(USERNAME);
pw := GET_APPLICATION_PROPERTY(PASSWORD);
cs := GET_APPLICATION_PROPERTY(CONNECT_STRING);
END;
BEGIN
get_connect_info;
IF un IS NOT NULL THEN
LOGON(un, pw||'@'||cs, FALSE);
IF FORM_SUCCESS THEN /* Successful logon */
connected := TRUE;
END IF;
END IF;
end;
Hope this helps
Ammar Sajdi
www.e-ammar.com
Amman - jordan
|
|
|