To Trap TNS Error [message #120173] |
Wed, 18 May 2005 02:59 |
karthi
Messages: 42 Registered: December 2000 Location: B'lore
|
Member |
|
|
Hi All,
I'm running a D2k Form(.fmx), it shows erro msg as "TNS failed". This error shows because I might have lost connection with the database, etc. Now Whts my doubt is... I want to track(trap) the TNS failed Error Msg and to give my own message, so that user can understand easily. Thanx.
--Karthik
|
|
|
|
|
|
Re: To Trap TNS Error [message #120302 is a reply to message #120206] |
Wed, 18 May 2005 19:25 |
danosw
Messages: 20 Registered: May 2005 Location: California
|
Junior Member |
|
|
We trap are users logon with:
--- ON-ERROR trigger
BEGIN
if error_code in ( 12154, 12203) then
message('Logon failed: Please check the database name.');
elsif error_code in ( 1017 ) then
message('Logon failed: Please verify your username and password.');
else
message(error_code||' '||error_text);
end if;
END;
--------
If you want to start forms without connecting to the database:
1) setup form to start without login.
code ON-LOGON at form level to:
null;
2) Do the login, and trap the error.
LOGON_SCREEN examples
/*
** Built-in: LOGON_SCREEN
** Example: Use the default Form Builder logon screen to prompt
** for username and password before logging on to
** the database. This uses the 'Get_Connect_Info'
** procedure from the GET_APPLICATION_PROPERTY
** example.
*/
DECLARE
un VARCHAR2(80);
pw VARCHAR2(80);
cn VARCHAR2(80);
BEGIN
/*
** Bring up the logon screen
*/
Logon_Screen;
/*
** Get the username, password and
** connect string.
*/
Get_Connect_Info( un, pw, cn );
/*
** Log the user onto the database
*/
IF cn IS NOT NULL THEN
LOGON(un,pw||'@'||cn);
ELSE
LOGON(un,pw);
END IF;
END;
|
|
|