Here's a guess: The following query will return NULL for internally-generated connections, also called temporary connections, whereas it will return an actual user name for client connections, event connections and web service connections: SELECT CONNECTION_PROPERTY ( 'UserID', [connection-number] ); |
I assume you will already know all of this, and I know you asked about all versions but:
Thanks... I am interested in distinguishing the internal connections from all the others, "temporary" or not. The Help seems to count only "INT:" connections in the definition of "temporary" but I don't care about the terminology... I just care about how to distinguish the internally-generated connections from all the others including clients, web services and events.
(20 Mar '12, 08:55)
Breck Carter
Replies hidden
2
My guess based upon a how a number of internal connections are implemented is that most and perhaps all internal connections will have a NULL UserId as you initially ask in your question. But I also expect that while a client connection is being established, it will briefly (for less than a millisecond normally) have a NULL UserId. So this test wouldn't be completely reliable. Perhaps this could be made more reliable by also checking something like connection_property( 'CommProtocol' ), which I think would be NULL for an event or internal connection.
(20 Mar '12, 09:56)
Ian McHardy
Thanks! In this case, testing UserID is sufficient since the code is trying to exclude internal connections from being dropped because they are committing evil acts, like consuming all the CPU or blocking all other connections... and they probably can't do evil in the first millisecond :)
(20 Mar '12, 12:28)
Breck Carter
|
AFAIK, with v12, event connections take the event name as their "name", and they do not have a parent connection, so they are easily distinguishable from "internal" connections. |
Hm, I would have considered event connections internal ones, too... Or are you dealing with "temporary connections"?
...thanks for the terminology heads-up.
...the next question might be "How do I name temporary connections in all versions of SQL Anywhere?"
At least I was unaware of that term before v12 was released...
I don't think you can... giving them connection names is a V12 enhancement that came with the (wonderful!) ParentConnection property.