Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi, version SQL Anywhere 16,

So I'm trying to create a check using database layer/PB app to check if one particular username is already logged in. Upon supplying of userID and pwd and establishing DB connection, I immediately want to check is there another active connection for the same user to see if the user is already connected.

I've been calling sa_conn_info() from ISQL and I get nicely all active connections, sometimes 7, sometimes 10, depends. In fact, I'm not really calling sa_conn_info() itself, but just using the query that is defined within it, which is

select "Number",
"connection_property"('Name',"Number") as Name,
"connection_property"('Userid',"Number") as UserID,
"connection_property"('CommLink',"Number") as CommLink,
"connection_property"('LastReqTime',"Number") as LastReqTime
from "dbo"."sa_conn_list"(null,null);

If I call that from ISQL I see all DB connections. When I try to do the same from PB code (just after our login and DB connection initialisation) by calling a retrieve on datastore with the above, the datastore always returns 1 row for 1 connection of the user just logged in. I immediately run the same query in ISQL - I see many connections.

So I wrote a DB stored function which calls the above query, loops through it and reports number of connections. When I call it from ISQL, I get 7 or 10 or whatever rows. When I call the stored function explicitly from PB code, I get only one row again. How come?

What am I doing wrong? How come a call from PB app always returns only one, that, connection, and a call from ISQL returns all? Or is there an easier way, is there a SYS table which keeps the data rows on active DB connections?


asked 07 Mar '19, 14:06

PcrMember's gravatar image

accept rate: 0%

With v16 and above, the user needs to have the MONITOR privilege to see details of other connections. I assume the application user does not have that privilege.

The behaviour does not depend on the application itself, so DBISQL does not behave differently here than any other application.

permanent link

answered 07 Mar '19, 14:20

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 07 Mar '19, 14:28

Brilliant, works now. We can probably give users that privilege.

Thanks very much, I knew it was something easy I was overlooking.

(07 Mar '19, 14:40) PcrMember
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 Mar '19, 14:06

question was seen: 1,275 times

last updated: 07 Mar '19, 14:40