Re: create logon trigger



emdproduction@xxxxxxxxxxx wrote:
Dear group,

I want to maintain a table, so that if people in this table, they can
logon using sqlplus, if they are not, they can only logon through our
application server.

So

this trigger works fine
============
CREATE OR REPLACE TRIGGER rds_logon_trigger
2 AFTER LOGON ON DATABASE
3 BEGIN
4 IF SYS_CONTEXT('USERENV','IP_ADDRESS') not in
('192.168.2.1','192.168.2.2','192.168.2.3') THEN
5 RAISE_APPLICATION_ERROR(-20003,'You are not allowed to connect to
the database');
6 END IF;
7* end;
=============
But if i want to use a query, I got an error

=================
CREATE OR REPLACE TRIGGER rds_logon_trigger
AFTER LOGON ON DATABASE
BEGIN
IF SYS_CONTEXT('USERENV','IP_ADDRESS') not in (select '1' from dual)
THEN
RAISE_APPLICATION_ERROR(-20003,'You are not allowed to connect to the
database');
END IF;
end;
2/47 PLS-00405: subquery not allowed in this context


Is there any way I can achieve what i wanted?

Thanks for your help

My 2 cents... go for Secure Application Roles

example here:

http://www.oracle.com/technology/obe/obe10gdb/security/approles/approles.htm

cheers,
pedro
.



Relevant Pages

  • Re: No one could logon to productio database for a while
    ... While this logon trigger is being executed, ... will Oracle wait for logon trigger to be completed before they ... can connect or will Oracle execute another "instance" of logon ...
    (comp.databases.oracle.server)
  • Re: Capture SQL Server Connections
    ... LOGON TRIGGERS are only support in SQL Server 2005+. ... As long as the LOGON TRIGGER is running the connection is not yet made ... connecting so I can provide a custom authenication mechanism? ...
    (microsoft.public.sqlserver.server)
  • Re: No one could logon to productio database for a while
    ... While this logon trigger is being executed, ... can connect or will Oracle execute another "instance" of logon ... We have no of process set to 1200 and there were only 383 oracle shadow ...
    (comp.databases.oracle.server)
  • Re: No one could logon to productio database for a while
    ... While this logon trigger is being executed, ... can connect or will Oracle execute another "instance" of logon ... We have no of process set to 1200 and there were only 383 oracle shadow ...
    (comp.databases.oracle.server)
  • Re: Capture SQL Server Connections
    ... As long as the LOGON TRIGGER is running the connection is not yet made available to the user. ... If your C# code is implemented as a SQL Server CLR stored procedure, ... >>> connecting so I can provide a custom authenication mechanism? ...
    (microsoft.public.sqlserver.server)