SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sql server 2000: how to limit a users session connecting to the database.


sql server 2000: how to limit a users session connecting to the database.

Author
Message
sql-noob
sql-noob
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 178
if a user connects from the application end to the database, he gets only 30 minutes of session time after which the session gets expired and he has to connect again.

how do i implement it in SQL SERVER 2000.
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24163 Visits: 13362
Not easy to do in SQL 2000.
However, let me ask, why would you ever want to do this?

--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
sql-noob
sql-noob
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 178
a request from the client side, the problem is there are no logon triggers in sql server 2000, so is it feasible to write a procedure to check the session time for that particular user and schedule it to run every 5 min?
or is there any other way to do it?
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24163 Visits: 13362
That's how I would do it.
Even if SQL Server 2000 had logon triggers, it would not help, as you would have to check for existing sessions, not for new ones.

--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
sql-noob
sql-noob
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 178
having a small doubt(silly one)

if i write a logon trigger(forget the sql version), is it like : after the completion of trigger the user gets the access or he gets the access while the trigger is running?
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24163 Visits: 13362
Not sure what you mean.
The logon trigger is executed as part of the log on process. The session is established before the trigger runs, but the session is not available to the user until the trigger code completes.
I hope this clarifies things instead of complicating...

--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
sql-noob
sql-noob
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 178
thanks for resolving my doubt!
Is there any other way instead of procedures to accomplish session time limiting in sql server 2000?

if it is sql server 2008, what's the way?
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24163 Visits: 13362
Not very different in SQL 2008.
Is there any chance to let the application do that?

--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
sql-noob
sql-noob
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 178
yes that can be done,
i am working on the issue from my end by using (sys.dm_exec_sessions) or should i use something else?
Gianluca Sartori
Gianluca Sartori
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24163 Visits: 13362
In SQL2008 you probably want to use sys.dm_exec_sessions and identify sessions that have been idle for the last 30 minutes:


DECLARE @idle_timeout int = 30; -- minutes

SELECT session_id
,status
,login_time
,host_name
,program_name
,host_process_id
,original_login_name
FROM sys.dm_exec_sessions
WHERE status = 'sleeping'
AND last_request_end_time < DATEADD(minute, -1 * @idle_timeout, GETDATE())
AND is_user_process = 1



--Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search