Home » Developer & Programmer » Forms » LOGON function (Oracle form 12c )
LOGON function [message #678283] Sat, 23 November 2019 03:12 Go to next message
Shiv93
Messages: 31
Registered: September 2019
Member
Hi,

I have a requirement of to connect to a Database from forms but not sure how to implement it from the oracle forms.
Can anyone let me know hoe to implement the logic?
Re: LOGON function [message #678284 is a reply to message #678283] Sat, 23 November 2019 03:48 Go to previous messageGo to next message
Michel Cadot
Messages: 66934
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Here?

Re: LOGON function [message #678293 is a reply to message #678284] Sat, 23 November 2019 06:41 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
HI ,
i guess i will elaborate it more on whats my requirements.

I have an database and my form is currently getting connected to it in the schema level(i.e username & pwd is my schema name) but when im trying to use my user id am not able to get through.


cs = my database name;
LOGON (uname, pwd || '@' || cs, FALSE);
Re: LOGON function [message #678306 is a reply to message #678293] Sat, 23 November 2019 18:17 Go to previous messageGo to next message
BlackSwan
Messages: 26669
Registered: January 2009
Location: SoCal
Senior Member
Sivachandran wrote on Sat, 23 November 2019 04:41
HI ,
i guess i will elaborate it more on whats my requirements.

I have an database and my form is currently getting connected to it in the schema level(i.e username & pwd is my schema name) but when im trying to use my user id am not able to get through.


cs = my database name;
LOGON (uname, pwd || '@' || cs, FALSE);

There are two problems with post above.
1) We don't know what actual code is contained in LOGON function above.
2) We don't know what actual error gets throw & reported by you as "not able to get through".

Since we don't know what you really do or how Oracle DB responds we can't begin to speculate what is wrong or how to fix it.
Re: LOGON function [message #678325 is a reply to message #678306] Sun, 24 November 2019 15:30 Go to previous messageGo to next message
Littlefoot
Messages: 21548
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, LOGON built-in exists, you can use it, but ... what benefit do you expect from it? I mean, what difference will it make if you login as you do it now (<Ctrl + J> and fill username, password and database) or using the LOGON?

Did you follow the example Oracle provides in Forms Online Help system?

Did you read the documentation? If you did, why did you set the last (optional) parameter to FALSE? TRUE is default and might actually help:

Forms Help, LOGON built-in, logon_screen_on_error parameter


An optional BOOLEAN parameter that, when set to TRUE (default), causes Forms Developer to automatically display the logon screen if the logon specified fails (usually because of a incorrect username/password). When logon_screen_on_error is set to FALSE and the logon fails, the logon screen will not display and FORM_FAILURE is set to TRUE so the designer can handle the condition in an appropriate manner.
Re: LOGON function [message #678329 is a reply to message #678325] Mon, 25 November 2019 02:32 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
Hi LittleFoot/BlackSwan ,
Thanks for your time in replying.

SO i have designed a login page with two inputs and a login button.
1. username
2. pwd

on click of the login button i execute the following code.
Begin

LOGON (Username, pwd || '@' || 'DB', FALSE);
IF FORM_SUCCESS THEN
call_form('new_form',HIDE,DO_REPLACE);
ELSE
MESSAGE('Unable to Connect to the form');
END IF;

END;

So now my question is on what basis the LOGON inbuilt function validates the user . Does it looks for the schema name in the DB to validate the user,because if i login with the schema name i was able to login to the form successfully.

[Updated on: Mon, 25 November 2019 02:44]

Report message to a moderator

Re: LOGON function [message #678335 is a reply to message #678329] Mon, 25 November 2019 04:07 Go to previous messageGo to next message
cookiemonster
Messages: 13864
Registered: September 2008
Location: Rainy Manchester
Senior Member
In oracle schema=user.
You seem to think otherwise.
So what is user to you?
Re: LOGON function [message #678336 is a reply to message #678306] Mon, 25 November 2019 04:15 Go to previous messageGo to next message
cookiemonster
Messages: 13864
Registered: September 2008
Location: Rainy Manchester
Senior Member
[quote title=BlackSwan wrote on Sun, 24 November 2019 00:17]Sivachandran wrote on Sat, 23 November 2019 04:41

There are two problems with post above.
1) We don't know what actual code is contained in LOGON function above.
If you're going to comment on forms issues it's help if you knew something about forms.
Logon is a forms built-in function. The only people who get to see the actual code it contains are actual oracle employees.
Re: LOGON function [message #678434 is a reply to message #678336] Tue, 03 December 2019 13:12 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
Hi Cookiemonster,

Thanks for your reply..

My problem is I have a DB with multiple schema say for example schema_1, schema_2,schema_3 and my default schema is schema_1.

So when I'm connecting with my user ID it's getting me connected to the default taht is schema_1.
LOGON (Username, pwd || '@' || 'DB', FALSE);

So is there anyway that I can connect my user ID to other schema like schema_2 or schema_3..
Re: LOGON function [message #678439 is a reply to message #678335] Wed, 04 December 2019 03:58 Go to previous messageGo to next message
cookiemonster
Messages: 13864
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Mon, 25 November 2019 10:07
In oracle schema=user.
You seem to think otherwise.
So what is user to you?
If your SQL statements are running against tables belonging to other schemas it'll be because

a) the code specifies the schema in the SQL
b) there are synonyms that point to the tables in the other schema
c) the following has been run:
alter session set current_schema = <schema name>

Re: LOGON function [message #679811 is a reply to message #678439] Mon, 30 March 2020 23:18 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
HI Cookiemaster,

I ran the below piece to switch to schema_2 but getting error in the new_form(fmb) which has a trigger looking for the weblogic ,Database and machine details. It basically checkks the tables like v$session(for weblogic information),v$process(for machine information),v$parameter (for database info). The error am getting is table or view doesnt exist for the above 3 mentioned tables. Can you please let me know what's wrong with my approach.

Declare
Uname varchar(20);
pwd varchar(20);
db varchar(20);

Begin
Uname := :login.USERNAME;
pwd := :login.PASSWD;
db := :login.DB;

LOGON (Uname , pwd || '@' || 'DB', FALSE);
IF FORM_SUCCESS THEN
FORMS_DDL('ALTER SESSION SET CURRENT_SCHEMA = SCHEMA_2');
call_form('new_form',HIDE,DO_REPLACE);
ELSE
MESSAGE('Unable to Connect to the form');
END IF;
END;

Re: LOGON function [message #679812 is a reply to message #679811] Tue, 31 March 2020 03:39 Go to previous messageGo to next message
Littlefoot
Messages: 21548
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's a walkthrough which shows what you have, what you should (and should not) do to make it work.

Connected as SCOTT, I can't select from v$session:
SQL> show user
USER is "SCOTT"
SQL> select count(*) from v$session;
select count(*) from v$session
                     *
ERROR at line 1:
ORA-00942: table or view does not exist
Connect as a privileged user (it is SYS in my test XE database; use your own user you use for such purposes) and grant SELECT. Note the difference!
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> grant select on v$session to scott;
grant select on v$session to scott
                *
ERROR at line 1:
ORA-02030: can only select from fixed tables/views


SQL> grant select on v_$session to scott;

Grant succeeded.
Back to SCOTT:
SQL> connect scott
Enter password:
Connected.
SQL> select count(*) from v$session;

  COUNT(*)
----------
        24

SQL>

[Updated on: Tue, 31 March 2020 03:41]

Report message to a moderator

Re: LOGON function [message #679823 is a reply to message #679812] Thu, 02 April 2020 13:25 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
HI Littlefoot,

Thanks for your time in replying. After DBA provided grant permission to that user i was able to access those table informations.

Now i have one more question regarding with the LOGON inbuilt function..

LOGON (Uname , pwd || '@' || 'DB', FALSE);
If my password has any "@" character to it will the LOGON function work coz am getting error.

Consider if username is " JHON" and password is "World@2020". so now this username and password when applied to the LOGON function looks like this if am right.


LOGON (JHON, World@2020|| '@' || 'DB_NAME', FALSE);
with the above said format, the LOGON function assumes after the first "@" in my password as my DB name...

Can you please suggest how to overcome this issue.
Re: LOGON function [message #679824 is a reply to message #679823] Thu, 02 April 2020 13:29 Go to previous messageGo to next message
Michel Cadot
Messages: 66934
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Try to put the password between double quotes.
LOGON (JHON, '"World@2020"'|| '@' || 'DB_NAME', FALSE); 
Re: LOGON function [message #679836 is a reply to message #679824] Sat, 04 April 2020 12:26 Go to previous messageGo to next message
Shiv93
Messages: 31
Registered: September 2019
Member
Hey Mike,

Thanks for the suggestion and it worked.Now am able to login if my password has @ character in it..
Re: LOGON function [message #679837 is a reply to message #679836] Sat, 04 April 2020 12:33 Go to previous message
Shiv93
Messages: 31
Registered: September 2019
Member
Gentleman's ,

Just a quick question, if i'm clicking an exit menu from my application and my login page is displayed with the user entered information's. Is there any way to remove those information entered and show a blank page ?
Previous Topic: forms 11 g urdu language data view problem
Next Topic: Free software replacement for Oracle Forms
Goto Forum:
  


Current Time: Sat Apr 04 23:10:20 CDT 2020