use the on logon trigger along with the function logon
Main Topics
Browse All TopicsHi Gurus,
MY Environment is
1) Backend Oracle 10g Release 2
2) Oracle Forms 6i with Patch 18
Here is an intresting thing which I have encounter may be it's an approach issue but thats how we have to do the job.
Senarios 1:
I have a custom login form which calls a main_menu form and then from there individual options runs.
Considerations:
1) User logins once
2) We set global variables at login
3) We login at login forms on-logon trigger a default user
now we wana change the things work earlier, now we have multiple users and a drop down combo
where user select where to login depending on that selection we wana re-login with different oracle DB user.
CASE:
It doesn't change the user.
Senario 2:
I wana read registry from PL/SQL and I found a way to do it but it doesnt work.
It compiles fine but at runtime it give an error FRM-40734.
I have check that the library D2KWUTIL is attached and there is not issue regarding this.
Please help its an urgent nature issue and management is looking towards this solution.
So test your knowledge here as I am.
Please Help your most urgent reply is desireable.
Advance Thanks and regards,
Zee
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
My friend I know that Oracle 10gR2 and 6i is a problem but my management is insisting to take this bully.
That's why I said there may be an issue of approach but we have to do it this way.
Secondly, I have tried On-Logon with logon function it doesnt change user from a MDI form to SDI form it remains the same as first passed user at on-logon trigger and even though you re-use logon function on called form on on-logon trigger it never change it.
And again it's an issue of approach that my management create user every year with a post-fix YY and reluctant to use partition clause to avoid performance issue. It may be ignorance of lack of knowledge but thats the way it is (By the way I recently joined the comapny)
Anyways we need solution if any of the masters or guru could provide it.
And by now you must have understood that why we wana change user at logon form because user may wana go to Year 2006-2007 or 2007-2008 and so on and there are different physical DB users and management dont wana change the approach.
We can use HOST cammand and pass USERID/PASS but it that case environment global variable values gets lost which we cant afford since it is security / right concern variables.
Regards,
Zee.
We use the logon built-in in Oracle Forms6i to swithch the user, both in the on-login trigger as well as optionally via a key trigger. Having to use a differnt logon though just to see data for a different year looks like a an application and/or database design problems. It shouldn't be neceassry to use a different logon to see data for a different year.
You indicated that management is reluctant to use partitions, but they can be very helpful for performance and data management. It sounds like your management doesn't want to use Oracle the way it works best. It seems like they want Oracle to work the way they think is best. They didn't write Oracle though.
My Friend Again,
This is an issue with us. My management is a very old school. And u'll be surprise that we don't even have primary keys and foreign keys in our system which is not even a school old or new is out of question, so u can imagine.
Anyways, if u r saying that we can use LOGON built-in to switch the user when calling a form from custom logon form to mainmenu form so we have tried it is not working. And this was my first that it should work but it isn't.
Here is the code:
Declare
the_connect varchar2(100);
Begin
the_connect := Get_Application_Property(C
if the_connect is not null then
logon('tbs','XXX@'||the_co
ELSE
LOGON('tbs','XXX@ecltest')
END IF;
END;
We have tried the hard coded version on connect string as well just to check even thoug it doesn't make any difference since it is only geting the service name and username and password is hardcoded in this code.
Thanks and Regards,
Zee
Here is part of a program unit that we use in the ON-LOGON trigger of the startup form for our application. We also call this same program unit from a key trigger that the operators can use at any time to switch between our test system and our production system. This key trigger works from the menu that is attached to all of our 6i forms, but we haven't tested this much with 10gR2. We noticed significant record-locking problems with that combination, so we won't use 10gR2 until we upgrade our application to Froms10.
-- Check username first:
LOGON('scott', 'tiger@' || common_pkg.db_name, FALSE);
user_ok := user_pkg.ck_user(common_pk
-- message('User_ok: "'||user_ok||'"');
if user_ok in ('X','Y') then
if user_ok = 'Y' then
logout;
-- message('Trying logon with a database password');
db_secur := 'Y';
-- Attempt a logon with a database password:
LOGON(common_pkg.user_nm,c
else
user_pkg.pwd_valid(common_
logout;
-- Check if password is expired, and do not fail here if that is true:
if pw_valid = 'N' then
if msg_text = 'Your password has expired. Please change it.' then
pw_valid := 'Y';
end if;
end if;
if pw_valid = 'Y' then
-- Attempt a logon with the "application standard" password:
LOGON(common_pkg.user_nm,d
else
display_alert('Logon Error',msg_text);
end if;
end if;
IF FORM_FAILURE or pw_valid = 'N' THEN
-- see if logon works with a valid username
LOGON('scott', 'tiger@' || common_pkg.db_name, FALSE);
IF FORM_FAILURE THEN
-- no one is able to connect to oracle
display_alert('Logon Error',
'Error connecting to Oracle. Please call the Help Desk at x382.');
else
-- don't stay connected as this user (SCOTT/TIGER)
logout;
END IF;
-- this user must be invalid
if nvl(pw_valid,'Y') = 'Y' then
display_alert('Invalid User/Password',
'Invalid username or password provided. Please try again.');
end if;
ELSE -- logon with returned values succeeded;
if db_secur = 'Y' then
pw_valid := 'Y';
end if;
if pw_valid = 'Y' then
exit;
else
logout;
Hi Friends,
This what I used and it worked as my last comment it was the issue of the behavior of LOGON Built-in
it calls ON-Logon Trigger when called and the code on that trigger was hard coded thats why it was always changing the user to default.
Here what I rewrite and we just change the GLOBAL variable values.
BEGIN
DEFAULT_VALUE('N','global.
DEFAULT_VALUE('N','global.
DEFAULT_VALUE('N','global.
DEFAULT_VALUE('N','global.
IF :global.logon_now = 'Y' THEN
LOGON(:global.un, :global.pw||'@'||:global.c
END IF;
END;
Sorry I coulgn't come back for couple of days.
Regards,
Zee
Business Accounts
Answer for Membership
by: markgeerPosted on 2007-07-13 at 11:20:25ID: 19483222
I hope you are aware that Forms6i is considered obsolete and is no longer supported by Oracle. (Yes, we run it too yet, but we hope to upgrade to Forms10 in the next couple of months).
The combination of Forms6i and Oracle10gR2 is problematic. We use Forms6i with 10gR1, and that works well.
The D2KWUTIL library in Forms6i can be used to read the Windows registry (we do) at least with WindowsXP or earlier. Windows Vista though is another matter - that may or may not work. In our preliminary tests it did not work, but we are planning to do more tests of that combination yet.
It is possible in Forms6i to change the login, we do that in our custom application.