Hi,
Can I check and limit number occurrence users connect to sql server? Please
advice.
Thanks.js wrote:
> Hi,
> Can I check and limit number occurrence users connect to sql server?
> Please advice.
> Thanks.
You can set an overall connection limit by changing the Maximum
Concurrent User Connections in SQL EM or using the "User Connections"
parameter with sp_option. If you're asking whether you can say "USER 1"
can only have two concurrent connections and "USER 2" can have only 1
concurrent connection, I don't think that's possible - unless you do
this from your application and check the sysprocesses table (SQL 7 /
2000) or sys.dm_exec_connections table in SQL 2005.
--
David Gugick
Quest Software
www.quest.com|||Thanks David,
Two more questions:
1. from one computer, my app connect to sql server, two database(db1, db2).
how many connections for this scenario?
2. Is it USER and machine the same thing? can I limit the number occurrence
machine?
Thanks again.
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:uUQD6ziFGHA.3900@.TK2MSFTNGP10.phx.gbl...
> js wrote:
>> Hi,
>> Can I check and limit number occurrence users connect to sql server?
>> Please advice.
>> Thanks.
> You can set an overall connection limit by changing the Maximum Concurrent
> User Connections in SQL EM or using the "User Connections" parameter with
> sp_option. If you're asking whether you can say "USER 1" can only have two
> concurrent connections and "USER 2" can have only 1 concurrent connection,
> I don't think that's possible - unless you do this from your application
> and check the sysprocesses table (SQL 7 / 2000) or sys.dm_exec_connections
> table in SQL 2005.
> --
> David Gugick
> Quest Software
> www.quest.com|||js wrote:
> Thanks David,
> Two more questions:
> 1. from one computer, my app connect to sql server, two database(db1,
> db2). how many connections for this scenario?
> 2. Is it USER and machine the same thing? can I limit the number
> occurrence machine?
You don't really connect to a database. You connect to a server (read: a SQL
Server). You have a default database or you may provide one in the
connection string, but you are still connecting to the server. How many
connections depends on your source code. Presumably you have two Connection
objects (ADO) or two SqlConnection classes (.Net). In that case, you
probably have two separate connections. Is there a reason your application
requires two active connections? If it's a matter of accessing objects in
two different databases on the same server, you can eliminate one connection
simply by using fully qualified references (database.owner.object). At the
very least, you should use the owner.object syntax for all objects
referenced in your SQL. There is not need to switch databases, which is an
expensive operation, in order to access objects in a particular database.
To the second question: a user and a connection are not the same thing. A
user is granted access to SQL Server (or not granted access as the case may
be). That user can establish any number of connections.
--
David Gugick
Quest Software
No comments:
Post a Comment