Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

A funny question!

Unfortunately we can't create a trigger which observes SELECTs on a table.

Has maybe someone an idea how can I log each query on each table in my DB? (the goal is for analysing an error in our application).

asked 30 Jun '21, 09:35

Baron's gravatar image

accept rate: 48%

the goal is for analysing an error in our application

If you tell what kind of error you are trying to diagnose, we might provide more specific help, as the suggested RLL, ODBC tracing and auditing facilities seem all helpful - but possible much too general for your issue (aka too much noise around the signal)...

(30 Jun '21, 11:08) Volker Barth

Request-level logging is (apparently) described in two places...

Request Logging

Logging Server Requests

See also the Tracing tab in the ODBC Data Source Administrator. Be careful, however, to turn the trace off when you're done, otherwise you'll fill up the disk :)

permanent link

answered 30 Jun '21, 10:54

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

Have a look at Auditing in the documentation - it might give you what you need.

permanent link

answered 30 Jun '21, 10:26

Justin%20Willey's gravatar image

Justin Willey
accept rate: 20%

I find only these 2 procedures:



But how can I log all SELECTs on a specific Table?

(30 Jun '21, 10:49) Baron
Replies hidden

You will not find any trigger-like features for SELECT statements, they don't exist, and they won't ever exist IMO.

(30 Jun '21, 10:56) Breck Carter

I don't think that any of the options let you specify particular tables for auditing or request logging.

(30 Jun '21, 10:57) Justin Willey
Comment Text Removed

I find only...

See Tutorial: Auditing in the SQL Anywhere Help.

(30 Jun '21, 11:00) Breck Carter

Ok, what should then I understand from the answer:

Have a look at Auditing in the documentation - it might give you what you need.

(30 Jun '21, 11:06) Baron
Replies hidden

Just what it says. You asked how to "log each query on each table in my DB?" - that's one of the things auditing can do. It records queries in the transaction log.

Whether it does it in a way that is useful to you, only you can decide.

(30 Jun '21, 11:16) Justin Willey

But according to the tutorial (so far as I understood), auditing logs any violation in the transaction log (i.e. it logs a failed attempt to query a table), but it doesn't log successfull queries on the same table.

(01 Jul '21, 03:40) Baron

Just try the sample when using a user with according permission to do the sample select, e.g. the user "BROWSER" (password "browse" according to the docs), and check what the log reveals.

(FWIW, I added a comment to your question, just in case...)

(01 Jul '21, 04:10) Volker Barth
showing 2 of 8 show all flat view
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: 30 Jun '21, 09:35

question was seen: 881 times

last updated: 01 Jul '21, 04:11