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: 34
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: 68625
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: 34
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: 26766
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: 21806
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: 34
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: 13917
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: 13917
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: 34
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: 13917
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: 34
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: 21806
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: 34
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: 68625
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: 34
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 messageGo to next message
Shiv93
Messages: 34
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 ?
Re: LOGON function [message #679838 is a reply to message #679837] Sun, 05 April 2020 10:09 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is it a custom login form? If so, clear items in WHEN-NEW-FORM-INSTANCE trigger.
Re: LOGON function [message #680627 is a reply to message #679823] Tue, 26 May 2020 17:12 Go to previous messageGo to next message
Sparrow_
Messages: 3
Registered: May 2020
Junior Member
Hi

I want to update the oracle's default logon form. Is it in fmb or fmx ?

Thanks
Re: LOGON function [message #680628 is a reply to message #678325] Tue, 26 May 2020 17:14 Go to previous messageGo to next message
Sparrow_
Messages: 3
Registered: May 2020
Junior Member
Hi

Where can I find oracle's built in Logon form?

Thanks
Re: LOGON function [message #680630 is a reply to message #680628] Wed, 27 May 2020 01:35 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Huh, I've heard that people created their own logon forms. I've never heard that anyone modified the default form. If it exists, I don't know its name but it is the FMB you can modify; FMX is executable, there's no use (nor possibility) to modify it.
Re: LOGON function [message #680649 is a reply to message #680630] Fri, 29 May 2020 13:06 Go to previous messageGo to next message
Shiv93
Messages: 34
Registered: September 2019
Member
Hello All,

Can someone let me know how we can get access the values that are stored in the Environment Configuration of the Enterprise manager in the oracle forms.

Re: LOGON function [message #680650 is a reply to message #680649] Fri, 29 May 2020 13:18 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Shiv93 wrote on Fri, 29 May 2020 11:06
Hello All,

Can someone let me know how we can get access the values that are stored in the Environment Configuration of the Enterprise manager in the oracle forms.

Answer is very version dependent for both Forms & Enterprise Manager.
Given that there is no requirement that Forms & EM need reside on same system, solution might be a challenge when they reside on different systems.
Re: LOGON function [message #680655 is a reply to message #680650] Sat, 30 May 2020 01:33 Go to previous messageGo to next message
Shiv93
Messages: 34
Registered: September 2019
Member
HI BlackSwan,

Thanks for your reply. Can you please explain more on this about the different system. Im currently using 12c version. My requirement is simple i have defined a variable USER_LANGUAGE with value as "ENGLISH" in the Environment configuration section. Now im trying to use that variable in my login form . When i use GET_APPLICATION_PROPERTY(USER_LANGUAGE)im getting a compilation error stating that USER_LANGUAGE is not declared.

Can you please help me on this..
Re: LOGON function [message #680664 is a reply to message #680655] Sat, 30 May 2020 11:50 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
GET_APPLICATION_PROPERTY accepts predefined set of properties. I'm not on 12c but 10g (well, not my choice, that's the way it is), and - in my version - Forms Help says that you can use USER_NLS_LANGUAGE:

Forms Help

USER_NLS_LANGUAGE Returns the current value of the language portion only of the USER_NLS_LANG environment variable defined for the form operator. If USER_NLS_LANG is not explicitly set, it defaults to the setting of NLS_LANG
Please, check your Forms Help and see what it says.

So, if you created your own variable, I don't think that built-in procedures see it just because you'd want them to. Or, if it is possible, I don't know how to do it.

A simple workaround is to create a table in the database and store your "settings" in there; then it is easy to fetch them into a form.
Re: LOGON function [message #680682 is a reply to message #680664] Sun, 31 May 2020 22:18 Go to previous message
Shiv93
Messages: 34
Registered: September 2019
Member
Hi LittleFoot,

Thanks for the reply. The workaround that you suggested can't be implemented because I'm trying to login to the form based upon that value that variable holds in the environment configuration. I dont want that value to be hardcoded in the login form and thats the reason i chose it to be in the environment configuration.
Only after login i will be able to hit the Database and fetch values.
Previous Topic: Issue while assigning summary calculated item to db item when-remove-record
Next Topic: Debugging not Working Forms 12c
Goto Forum:
  


Current Time: Thu Mar 28 16:34:09 CDT 2024