How to connect to database from oracle forms programmatically

Viewed 5481

I am using oracle forms 6i, I want to connect to database programmatically using pl/sql code

I don't want final user to insert username and password and database name when forms run like this image:

.I don't want final user to face this dialog

I used pre-form trigger like this:

begin
    execute 'connect to hr/hr@yemensoft';   
end;

But it returns with errors;

error 103 at line2, column 10 encountered the symbol "connect to hr/hr@yemensoft" when expecting one of the following: :=.(@%;

2 Answers

You'll have to use the LOGON built-in procedure:

LOGON('hr', 'hr@yemensoft');

LOGON Built-in

Description: Performs the default Oracle Forms logon processing with an indicated username and password. Call this procedure from an On-Logon trigger when you want to augment default logon processing. Syntax

PROCEDURE LOGON(username VARCHAR2, password VARCHAR2); 
PROCEDURE LOGON(username VARCHAR2, password VARCHAR2, logon_screen_on_error BOOLEAN);

The way to go is in your ON-LOGON trigger to have:

LOGON('hr', 'hr'||'@'||Get_Application_Property(CONNECT_STRING), false);

Make sure to add something like this in your formsweb.cfg:

[your-conf-for-db-yemensoft]
...
...
userid=@yemensoft
Related