Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

sql server 2000: how to limit a users session connecting to the database. Expand / Collapse
Author
Message
Posted Tuesday, August 7, 2012 6:13 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, 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.


Post #1341184
Posted Tuesday, August 7, 2012 7:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:10 AM
Points: 5,018, Visits: 10,526
Not easy to do in SQL 2000.
However, let me ask, why would you ever want to do this?


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1341247
Posted Tuesday, August 7, 2012 7:33 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, 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?
Post #1341256
Posted Tuesday, August 7, 2012 7:39 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:10 AM
Points: 5,018, Visits: 10,526
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

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1341262
Posted Tuesday, August 7, 2012 7:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, 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?
Post #1341267
Posted Tuesday, August 7, 2012 7:51 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:10 AM
Points: 5,018, Visits: 10,526
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

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1341274
Posted Tuesday, August 7, 2012 7:54 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, 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?
Post #1341278
Posted Tuesday, August 7, 2012 7:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:10 AM
Points: 5,018, Visits: 10,526
Not very different in SQL 2008.
Is there any chance to let the application do that?


--
Gianluca Sartori

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1341282
Posted Tuesday, August 7, 2012 8:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:34 AM
Points: 43, 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?
Post #1341294
Posted Tuesday, August 7, 2012 8:52 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:10 AM
Points: 5,018, Visits: 10,526
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

Get your two-cent-answer quickly
spaghettidba.com
@spaghettidba
Post #1341329
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse