Hi,

I am trying to write a rule that will query an oracle database to count
the number of lines in column(1), this is just to verify that the view
is populated with entries.

I've read a few posts and articles regarding the direct SQL query and I
believe I have configured a rule that seems to generate the required
code.

However, when the rule fires it doesn't seem to evaluate correctly. I
Have HTML encoded the < symbol in the SQL query as this was giving an
error.

The XML of the rule is below:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC
"policy-builder-dtd" "C:\Program Files
(x86)\Novell\Designer\plugins\com.novell.idm.polic ybuilder_4.0.0.201206110753\DTD\dirxmlscript4.0.2. dtd"><policy>
<rule>
<description>Query SQL to see if view is available</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="lv_SQLquery" scope="policy">
<arg-string>
<token-text xml:space="preserve">select count(1) </token-text>
<token-text xml:space="preserve">FROM </token-text>
<token-global-variable name="orahr.HR.fr.ViewName"/>
<token-text xml:space="preserve"> where rownum %3C
2000;</token-text>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="lvQuery" scope="policy">
<arg-node-set>
<token-xml-parse>
<token-text xml:space="preserve">&lt;jdbc:statement
xmlns:jdbc="urn:dirxml:jdbc">&lt;jdbc:sql></token-text>
<token-local-variable name="lv_SQLquery"/>
<token-text
xml:space="preserve">&lt;/jdbc:sql>&lt;/jdbc:statement></token-text>
</token-xml-parse>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="lvExecute" scope="policy">
<arg-string>
<token-xpath
expression="cmd:execute($destCommandProcessor,$lvq uery)"/>
</arg-string>
</do-set-local-variable>
</actions>
</rule>
</policy>

The trace when the rule fires seems to configure the SQL query, but then
it evaluates to just a "/" and I can't see why. As a result the query
gives an error. level 3 trace is below.

Is anyone able to help?

[01/08/15 15:14:11.979]:OracleJDBCDriver PT:Applying policy:
%+C%14CQuery SQL View%-C.
[01/08/15 15:14:11.979]:OracleJDBCDriver PT: Applying to status #1.
[01/08/15 15:14:11.979]:OracleJDBCDriver PT: Evaluating selection
criteria for rule 'Query SQL to see if view is available'.
[01/08/15 15:14:11.979]:OracleJDBCDriver PT: Rule selected.
[01/08/15 15:14:11.979]:OracleJDBCDriver PT: Applying rule 'Query SQL
to see if view is available'.
[01/08/15 15:14:11.980]:OracleJDBCDriver PT: Action:
do-set-local-variable("lv_SQLquery",scope="policy","select count(1)
"+"FROM "+token-global-variable("orahr.HR.fr.ViewName")+" where rownum
%3C 2000;").
[01/08/15 15:14:11.980]:OracleJDBCDriver PT: arg-string("select
count(1) "+"FROM "+token-global-variable("orahr.HR.fr.ViewName")+" where
rownum %3C 2000;")
[01/08/15 15:14:11.980]:OracleJDBCDriver PT: token-text("select
count(1) ")
[01/08/15 15:14:11.981]:OracleJDBCDriver PT: token-text("FROM
")
[01/08/15 15:14:11.981]:OracleJDBCDriver PT:
token-global-variable("orahr.HR.fr.ViewName")
[01/08/15 15:14:11.981]:OracleJDBCDriver PT: Token Value:
"XXCOHR_IDENTITY_MAJOR_V".
[01/08/15 15:14:11.981]:OracleJDBCDriver PT: token-text(" where
rownum %3C 2000;")
[01/08/15 15:14:11.981]:OracleJDBCDriver PT: Arg Value: "select
count(1) FROM XXCOHR_IDENTITY_MAJOR_V where rownum %3C 2000;".
[01/08/15 15:14:11.982]:OracleJDBCDriver PT: Action:
do-set-local-variable("lvQuery",scope="policy",arg-node-set(token-xml-parse("<jdbc:statement
xmlns:jdbc="urn:dirxml
:jdbc"><jdbc:sql>"+token-local-variable("lv_SQLquery")+"</jdbc:sql></jdbc:statement>"))).
[01/08/15 15:14:11.982]:OracleJDBCDriver PT:
arg-node-set(token-xml-parse("<jdbc:statement
xmlns:jdbc="urn:dirxml:jdbc"><jdbc:sql>"+token-local-variable("lv_SQLquery"
)+"</jdbc:sql></jdbc:statement>"))
[01/08/15 15:14:11.983]:OracleJDBCDriver PT:
token-xml-parse("<jdbc:statement
xmlns:jdbc="urn:dirxml:jdbc"><jdbc:sql>"+token-local-variable("lv_SQLquery")+"</jdbc:s
ql></jdbc:statement>")
[01/08/15 15:14:11.983]:OracleJDBCDriver PT:
token-xml-parse("<jdbc:statement
xmlns:jdbc="urn:dirxml:jdbc"><jdbc:sql>"+token-local-variable("lv_SQLquery")+"</jdbc
:sql></jdbc:statement>")
[01/08/15 15:14:11.984]:OracleJDBCDriver PT:
token-text("<jdbc:statement xmlns:jdbc="urn:dirxml:jdbc"><jdbc:sql>")
[01/08/15 15:14:11.984]:OracleJDBCDriver PT:
token-local-variable("lv_SQLquery")
[01/08/15 15:14:11.984]:OracleJDBCDriver PT: Token Value:
"select count(1) FROM XXCOHR_IDENTITY_MAJOR_V where rownum %3C 2000;".
[01/08/15 15:14:11.984]:OracleJDBCDriver PT:
token-text("</jdbc:sql></jdbc:statement>")
[01/08/15 15:14:11.985]:OracleJDBCDriver PT: Arg Value:
"<jdbc:statement xmlns:jdbc="urn:dirxml:jdbc"><jdbc:sql>select count(1)
FROM XXCOHR_IDENTITY_MAJOR_V whe
re rownum %3C 2000;</jdbc:sql></jdbc:statement>".
[01/08/15 15:14:11.985]:ORACLEJDBCDRIVER PT: TOKEN VALUE: {/}.
[01/08/15 15:14:11.985]:ORACLEJDBCDRIVER PT: ARG VALUE: {/}.
[01/08/15 15:14:11.986]:OracleJDBCDriver PT: Action:
do-set-local-variable("lvExecute",scope="policy",token-xpath("cmd:execute($destCommandProcessor,$lvquery) ")).
[01/08/15 15:14:11.986]:OracleJDBCDriver PT:
arg-string(token-xpath("cmd:execute($destCommandProcessor,$lvquery) "))
[01/08/15 15:14:11.986]:OracleJDBCDriver PT:
token-xpath("cmd:execute($destCommandProcessor,$lvquery) ")
[01/08/15 15:14:11.987]:OracleJDBCDriver PT: Direct command
from policy
[01/08/15 15:14:11.987]:OracleJDBCDriver PT:

[01/08/15 15:14:11.987]:OracleJDBCDriver PT: Pumping XDS to
eDirectory.
[01/08/15 15:14:11.987]:OracleJDBCDriver PT:
DirXML Log Event -------------------
Driver: \IDV-INT\Mazars\Services\DrvSet\OracleJDBCDriver
Channel: Publisher
Status: Warning
Message: Code(-8020) No <input> tag in document.
[01/08/15 15:14:11.997]:OracleJDBCDriver PT: Direct command
from policy result
[01/08/15 15:14:11.997]:OracleJDBCDriver PT:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Standard" version="4.0.2.0">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<output>
<status level="warning">Code(-8020) No &lt;input> tag in
document.<application>DirXML</application>
<module>OracleJDBCDriver</module>
<object-dn></object-dn>
<component>Publisher</component>
</status>
</output>
</nds>
[01/08/15 15:14:11.998]:OracleJDBCDriver PT: Token Value:
"DirXMLNovell, Inc.Code(-8020) No <input> tag in
document.DirXMLOracleJDBCDriverPublisher".
[01/08/15 15:14:11.999]:OracleJDBCDriver PT: Arg Value:
"DirXMLNovell, Inc.Code(-8020) No <input> tag in
document.DirXMLOracleJDBCDriverPublisher".


--
Jevans78
------------------------------------------------------------------------
Jevans78's Profile: https://forums.netiq.com/member.php?userid=7684
View this thread: https://forums.netiq.com/showthread.php?t=52542