Click to See Complete Forum and Search --> : Trigger not working


bk_raavi
10-06-2003, 01:40 AM
I have written a trigger to Prevent logon from a Computer with IP address 10.3.35.104
But this trigger is not working .

Create or replace trigger test
After logon on Schema
Begin
if sys_context('USERENV','IP_ADDRESS') = '10.3.35.104' then
raise_application_error(-20000,'U have no rights to Logon');
End If;
End ;

LKBrwn_DBA
10-06-2003, 10:48 AM
Did you try BEFORE logon?
:cool:

jmodic
10-06-2003, 02:41 PM
Originally posted by LKBrwn_DBA
Did you try BEFORE logon?
:cool:
Ni such thing exists in Oracle as BEFORE LOGON trigger. You can crate only AFTER logon triggers.

bk_raavi, are you sure you wan't the scope of this trigger to be SCHEMA, not DATABASE? In your case, for example, if you create your trigger logged as user SYSTEM, then the trigger will fire only if your application user will try to connect as oracle user SYSTEM. It will not fire if your application user will try to connect as oracle user SCOTT, for example. So as SCOTT you'll be able to connect to the database from any IP address, even from '10.3.35.104'. Only SYSTEM will not be able to connect from '10.3.35.104'.