LOGIN_PROCEDURE option

Function

Specifies a login procedure that sets connection compatibility options at startup.

Allowed values

String

Scope

Can be set for an individual connection or the PUBLIC group. DBA authority is required to set the option. Takes effect immediately.

Default

DBA.sp_iq_process_login

See also

“Initial option settings”

“sp_iq_process_login procedure”

“Managing IQ user accounts and connections” in Chapter 12, “Managing User IDs and Permissions” of the Sybase IQ System Administration Guide

Description

The default login procedure, sp_iq_process_login, executes when a user attempts to connect.

To use the Sybase IQ User Administration facility, LOGIN_PROCEDURE must be set to DBA.sp_iq_process_login.

You can also customize the default database option settings by creating a new procedure and setting LOGIN_PROCEDURE to call that new procedure. Do not edit sp_iq_process_login, sp_login_environment or sp_tsql_environment. The customized login procedure needs to be created in every database you might use.

Example

The following example shows an alternative to sp_iq_process_login. This example disallows a connection by signaling the INVALID_LOGON error.

create procedure DBA.login_check()
begin
 declare INVALID_LOGON exception for sqlstate '28000';
 // Allow a maximum of 3 concurrent connections
 if( db_property('ConnCount') > 3 ) then
 signal INVALID_LOGON;
 else
 call sp_login_environment;
 end if;
end
go
grant execute on DBA.login_check to PUBLIC
go
set option PUBLIC.Login_procedure='DBA.login_check'
go

An alternative means to disallow a connection is by using the RAISERROR statement:

CREATE MESSAGE 28000 AS 'User %1! is not allowed to connect there are already %2! users logged on';
ALTER procedure DBA.login_check()
begin
 declare INVALID_LOGON exception for sqlstate '28000';
 // Allow a maximum of 3 concurrent connections
 if( db_property('ConnCount') > 2 ) then
  RAISERROR 28000, connection_property('Userid'),
   db_property('ConnCount')
 else
  call sp_login_environment;
 end if;
end