Re: SQLOLEDB provider internally creates multiple connections to SQL server when commands executed asynchronous - can I control this?

Tech-Archive recommends: Fix windows errors by optimizing your registry



alex_wh@xxxxxxx wrote:
So the problem.
Server logic uses its own implementation of secured access to data, so
login and password used for ADO Connection object to its success
connectiong to the server (via TCP/IP).
Later user logins via customized server login procedure and server
stores user ID with SET CONTEXT_INFO feature of MS SQL server.
So any server procedures that wants to control user access, reads
"context_info" field of the "sysprocesses" system server table.

The need of using of CONTEXT_INFO feature is so: there is no need to
pass user id into every call of the protected server procedure. It is
fine (security, traffic, etc.)

I'm not sure I completely understand your description, but it seems that you
are misusing CONTEXT_INFO, which is intended to allow multiple batches to be
run on the same connection in order to facilitate the new MARS
functionality, not to allow multiple users to use the same user info. It
sounds as if you should be using the new "EXECUTE AS user" functionality to
accomplish your goal.


But on the client side, when application tryes to perform some
activity on the background using Command object with adAsyncExecute
flag, if Connection object is busy (executing or fetching), ADO
internally... creates additional TCP connection to the SQL server, and
performs nedded operation (I can see this with netstat utility). But
on the server side @@SPID is other (this is another session for SQL
server!), and context_info occures empty.

But the alternative would be that the asynchronous process would have to
wait for the ongoing process to complete. Is that what you really want? If
so, why are you calling it asynchronously?

Moreover, ADO drops unused connection "older-first", and other command
objects in application accorded to execute normal, synchronous
commands, becoms out of session context info on the server side.

Is there any way to control this automatic creation of connections to
the SQL server?

I doubt it, but I don't know for sure. I've never tried to do something like
this. Look into context-switching using EXECUTE AS.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Cross Transactions between ADO & ADO.Net
    ... connection--it thrashes the server unnecessarily and discards useful server ... goes away and quietly reopen the connection when they return. ... > DTC transactions are not only heavy, they might also cause deadlocks due ... We even call ADO ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Permissions???
    ... > Server: SQL Server 2000. ... > the user could Write/Read data from server and execute stored procedures. ... > The connection was made with DSNs. ... ADO gives the following message when using stored ...
    (microsoft.public.data.ado)
  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Cannot connect client to server 2003
    ... you need to reconfigure the IP schema of your SBS ... On the SBS 2003 Server open the Server Management console. ... On the Connection Type page, click Broadband, and then click Next. ... Alternate DNS server, type the IP addresses that are provided by your ISP ...
    (microsoft.public.windows.server.sbs)
  • Re: Outgoing POP3 email missing/lost/not received
    ... ISP's mail server instead of the domain name on the ... SUMMARY OF SETTINGS FOR CONFIGURE E-MAIL AND INTERNET ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)