Original Message:
Sent: Tue January 07, 2025 10:29 AM
From: brenda grossnickle
Subject: Adding ReportName, Path, User to the SQL Query
@HENK CAZEMIER - (1) how do you control what comments are added? (2) does this work for cqm and dqm (3) do i still have to uncomment and edit the CQEconfig.xml.sample and /configuration/xqe.config.xml files?
------------------------------
brenda grossnickle
BI Programmer Analyst
FIS
Original Message:
Sent: Tue January 07, 2025 09:55 AM
From: HENK CAZEMIER
Subject: Adding ReportName, Path, User to the SQL Query
Another(better) place to control the generation of comments in Native SQL is from the Admin pages

------------------------------
Kind regards,
Henk Cazemier
Original Message:
Sent: Tue January 07, 2025 09:40 AM
From: JEAM COELHO
Subject: Adding ReportName, Path, User to the SQL Query
Hi,
If you are using DQM Packages, you must configure ../configuration/xqe.config.xml
There is a missing line in this file that you should add to work.
After line
<includeMacroExpansionInXqeLogs enabled="false"/>
Add
<generateCommentsInNativeSQL enabled="true"/>
And uncomment tags <NativeCommentMacroAlternative> and <NativeCommentMacro>
------------------------------
JEAM COELHO
Cognos Solution Architect
LinkedIn: https://www.linkedin.com/in/jeamcoelho/
Original Message:
Sent: Tue January 07, 2025 09:26 AM
From: brenda grossnickle
Subject: Adding ReportName, Path, User to the SQL Query
I know that this is an old thread, but trying to get it to work. Followed the steps by @chadman hult and restarted Cognos service, but still the comments are not in the SQL passed to MS SQL server. Anyone able to get reportname, path and user added as comments to the generated sql? Also, should i be able to see these comments in the query -> properties -> generate sql within Cognos?
------------------------------
brenda grossnickle
BI Programmer Analyst
FIS
Original Message:
Sent: Fri April 21, 2023 09:20 PM
From: Chadman Hult
Subject: Adding ReportName, Path, User to the SQL Query
Yes you can enable Native SQL and Cognos SQL Comments by using the CQEconfig.xml.sample.
First rename to CQEconfig.xml.
Be careful as when enabling this file you inadvertently enable options as they are not commented out by default.
<component name="CQE">
<section name="DBConnectionPool">
<!-- Description: Database connection timeout. Default is 900 seconds (15 minutes) -->
<entry name="Timeout" value="900"/>
<!-- -->
<!-- Description: Database connection pool size. -->
<!-- Maximum number of connections managed by the report server process. Default=40 -->
<entry name="PoolSize" value="40"/>
<!-- -->
</section>
<section name="QueryEngine">
<!-- Description: queryReuse feature -->
<!-- value="0" means disable the feature -->
<!-- default is value="5" which means cache up to 5 result sets per session -->
<entry name="queryReuse" value="5"/>
<!-- to the beginning and --> ti the end
Change to comment out/disable
<component name="CQE">
<section name="DBConnectionPool">
<!-- Description: Database connection timeout. Default is 900 seconds (15 minutes) -->
<!-- <entry name="Timeout" value="900"/> -->
<!-- -->
<!-- Description: Database connection pool size. -->
<!-- Maximum number of connections managed by the report server process. Default=40 -->
<!-- <entry name="PoolSize" value="40"/> -->
<!-- -->
</section>
<section name="QueryEngine">
<!-- Description: queryReuse feature -->
<!-- value="0" means disable the feature -->
<!-- default is value="5" which means cache up to 5 result sets per session -->
<!-- <entry name="queryReuse" value="5"/> -->
CQE Config modifications
<configuration company="Cognos" version="0.1" rendition="cer2">
<component name="CQE">
<section name="QueryEngine">
<entry name="GenerateCommentInNativeSQL" value="1"/>
<!-- ( default(off)=0, on=1) -->
<entry name="GenerateCommentInCognosSQL" value="1"/>
<!-- ( default(off)=0, on=1) -->
<!-- The content of the comments is controlled with two entries, their
defaults are specified in the value attribute -->
<entry name="NativeCommentMacro" value="# 'NC user=' + $account.defaultName + 'report=' + $report + 'start=' + $startTime + 'modelPath=' + $modelPath + 'reportPath=' + $reportPath + ' queryName=' + $queryName + ' REMOTE_ADDR=' + $REMOTE_ADDR + 'HTTP_HOST=' + $HTTP_HOST + 'SERVER_NAME=' + $SERVER_NAME +' requestID=' + $requestID + 'sessionID=' + $sessionID #"/>
<entry name="CognosCommentMacro" value="# 'CC user=' + $account.defaultName + 'report=' + $report + 'start=' + $startTime + 'modelPath=' + $modelPath + 'reportPath=' + $reportPath + ' queryName=' + $queryName + ' REMOTE_ADDR=' + $REMOTE_ADDR + 'HTTP_HOST=' + $HTTP_HOST + 'SERVER_NAME=' + $SERVER_NAME +' requestID=' + $requestID + 'sessionID=' + $sessionID #"/>
------------------------------
Chadman Hult
Original Message:
Sent: Fri December 13, 2019 10:27 AM
From: Amy Rivito
Subject: Adding ReportName, Path, User to the SQL Query
I think you can modify the ..\configuration\CQEConfig.xml file to include this in the QueryEngine section.
<!-- Generation of comments in native sql and cognos sql.-->
<!-- entry name="GenerateCommentInNativeSQL" value="1"-->
<!-- ( default(off)=0, on=1) -->
<!-- entry name="GenerateCommentInCognosSQL" value="1"-->
<!-- ( default(off)=0, on=1) -->
<!-- The content of the comments is controlled with two entries, their defaults are specified in the value attribute -->
<!-- entry name="NativeCommentMacro" value="#'user=' + $account.defaultName + ' reportPath=' + $reportPath + ' queryName=' + $queryName + ' REMOTE_ADDR=' + $REMOTE_ADDR + ' SERVER_NAME=' + $SERVER_NAME + ' requestID=' + $requestID#"/-->
<!-- entry name="CognosCommentMacro" value="#'user=' + $account.defaultName + ' reportPath=' + $reportPath + ' queryName=' + $queryName + ' REMOTE_ADDR=' + $REMOTE_ADDR + ' SERVER_NAME=' + $SERVER_NAME + ' requestID=' + $requestID#"/-->
<entry name="GenerateCommentInNativeSQL" value="1"/>
We use a third party tool, Attunity, to capture this info for additional reporting. FYI most of our sources are Oracle.
------------------------------
Amy Rivito
Original Message:
Sent: Wed December 11, 2019 05:15 PM
From: brenda grossnickle
Subject: Adding ReportName, Path, User to the SQL Query
I want to add ReportName, Path, User to the SQL Queries that are sent to MS SQL. Currently all users access SQL using the same generic SQL login. So when there are really crappy reports, we don't know anything about the report except for the MS SQLl.
The 11.0 Administration and Security Guide, on page 132 talks about "Using application context in Dynamic SQL". It seems that this might work. But it says "Dynamic SQL", does this include saved reports? Has anyone done this, any gotchas?
------------------------------
brenda grossnickle
BI Programmer Analyst
FIS
------------------------------
#CognosAnalyticswithWatson