Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login Form in Oracle Forms 6i

Status
Not open for further replies.

guvnornutter

Technical User
May 27, 2003
3
NZ
Hi

I've just started learning Oracle/SQL in Oracle 8.1.7 and using Forms/Reports 6i.

I've created a database containing 8 tables and built some what I'd guess to be standard type forms where you can add/delete/update records from each table and then I've linked all these forms to a 'Main' form.

What I'd like to do next and have no idea how to do is:

Somehow create a 'Login' form which validates (or not) a user via a username/pw combination located in one of the created tables and then only allows entry to certain of the forms based I guess either on

1/ the username/pw combo itself or
2/ the role granted to that particular user.
If the username/pw combo is not correct then I guess it should tell the user its not correct or similar other wise
allow entry to a certain form or forms.

My understanding of how this should work itself is not that grant and hence makes it somewhat difficult to go about implementing any solution. Im guessing this probably is a common setup in oracle applications but it seems quite hard to find code or example .fmb forms to learn how to do this.

Any advice, code tips etc welcome

Regards
J
 
I wonder why don't you use Oracle login procedure? You don't need any tables to store credentials as Oracle maintains its own system of users/roles/privileges. And of course you will be asked for the username/password on startup af not logged on yet.
If you plan to use your own system, you should connect to database through some Oracle account, that at least has access to your tables (or some serverside procedure checking credentials). In this case you may call some procedure from when-new-form-instance trigger.

Regards, Dima
 
Okay I might be misunderstanding you here but I want to validate the users and be able to direct them to certain forms based on this, through the software/forms.
E.g. I have some users created in Oracle, these have a role each granted to them. However their only access to the database is to be through the forms I've generated and this access needs to be tracked via logging into the database through a 'login' form somehow.

Regards,
J
 
You may create some dummy root form and in WNFI trigger call the one you need by OPEN_FORM or CALL_FORM built-ins. In this case you shouldn't enter any extra elements to get username/password and may use Forms standard login procedure.

Regards, Dima
 
What I do in my forms:

In the first form of the app, use the ON-LOGON trigger to call another form to get name an password:

BEGIN
Call_form ('LOGON_APP', NO_HIDE);
IF :GLOBAL.logged_on != 'TRUE' THEN
RAISE Form_Trigger_Failure;
END IF;
END;

That form contains a LOGON_BLOCK WITH:
USERNAME
PASSWORD
CONNECT (connect string: the name of the database)
OK button
CANCEL button

The OK button contains:

IF :logon_block.username IS NULL THEN
BELL;
RETURN FALSE;
END IF;

Set_Application_Property(Cursor_Style, 'BUSY');

LOGON :)logon_block.username,
:logon_block.password||'@'||:logon_block.connect,
FALSE);

IF FORM_SUCCESS THEN
Set_Application_Property(Cursor_Style, 'DEFAULT');
RETURN TRUE;
ELSE
Set_Application_Property(Cursor_Style, 'DEFAULT');
res := Show_Alert ('probleme');
RETURN FALSE;
END IF;


which use standard Oracle connection scheme.
But after connection, you will be able to check things about the user.

You have to have
- an oracle USER for each person who connect to the application
- ROLE for these users (this role give rights to the users)
- Synonyms to PUBLIC or other user which is used by ROLE

This is a bit complex but it is the way it should be done.

Regards, Christian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top